Code Monkey home page Code Monkey logo

vue-fluid-dnd's Introduction

Icon
Vue Fluid DnD

npm bundle size license version GitHub issues GitHub stars twitter test_coverage

A fluid, smooth and versatil drag and drop library for lists on Vue3. It's a lightweight tool ~5 Kb (gzip) with no depenencies.

✨ Features

  • Fully customizable 🎨.
  • Zero dependencies 🪶.
  • Work with horizontal➡️and vertical list ⬇️.
  • Mouse 🐭 and touch 👉📱 (mobile, tablet and so on) support.
  • Nice documentation 📑 and examples.
  • Fully tested 🧪, typed and reliable.

🚀 Getting Started

  1. Install vue-fluid-dnd:

    # with npm:
    npm i vue-fluid-dnd
    
    # with yarn:
    yarn add vue-fluid-dnd
    
    # with pnpm:
    pnpm i vue-fluid-dnd
  2. Import the vue composable

    import { useDragAndDrop } from "vue-fluid-dnd";
  3. Create a list that your want to sort an use useDragAndDrop

    // Each element have its own styles or classes and the draggable-id
    const listToSort = ref([
      {
        number: 1,
        style:
          "color: white; background-color: red; width: 50px; margin: 23px 0;",
      },
      //...
    ]);
    // create the parent element and set drag and drop configuration on the parent and children elements (creating events, statees, styles, etc) calling useDragAndDrop composable
    const { parent } = useDragAndDrop(listToSort);
  4. Create childrens

    <template>
       <div ref="parent" style="width: 40%; display: block">
          <div
             v-for="(element, index) in listToSort"
             :index="index"
             :style="element.style"
          >{{ element.number }}
          </div>
       </div>
    </template>
  5. Documentation

  • 📚 Check out all the docs.
  • 🛠️ Edit the previous here.
  • 📘 See others examples here.

🤝 Contributing

If you're interested in contributing to vue-fluid-dnd, please read our contributing docs before submitting a pull request CONTRIBUTING.

🔑 License

vue-fluid-dnd's People

Contributors

carlosjorger avatar

Stargazers

Constantin Tsukanov avatar  avatar OFEII avatar  avatar  avatar Luis A. Guisado avatar jry avatar li-zhenfei avatar  avatar  avatar Al-Khawarizmi avatar Mahdi Salek avatar JDK avatar Mathieu Laurent avatar 陈随易 avatar Alok Vishwakarma avatar Mohammad Prince avatar  avatar Nikita avatar  avatar Carlos J. Ortiz avatar Emmanuel Genga avatar Ömer Aziz ŞAHİN avatar  avatar Matías Toledo avatar Sangyong Jung avatar Kristjan Metsalu avatar  avatar dai avatar  avatar Armen Rostamian avatar Jems avatar  avatar  avatar Andres Pérez avatar Hannes avatar Brian Saunders avatar McLOVIN avatar  avatar Robert Floyd avatar Wayne Buckhanan avatar  avatar  avatar Jeff avatar Wiki avatar Yoannis Sánchez Soto avatar Manuel Ernesto Garcia avatar Marlon Morales avatar 郝晨光 avatar MOD4EVER avatar Nicolas Rojo avatar Sasha Milenkovic avatar  avatar Ryan K avatar Andrei Culda avatar Jitender Bansal avatar  avatar Jawad Ahmed avatar Jose Luis Fleitas avatar Martin Malinda avatar Eduardo García Maleta avatar  avatar  avatar

Watchers

 avatar  avatar Jimmie Jackson avatar

Forkers

torchinside

vue-fluid-dnd's Issues

Change the API

Change the API for a much simpler one using a vue composable instead of draggable and droppable components.

Got an usability error on Firefox - Touch Events

I was trying the examples. But I couldn't drag and drop. I am using Firefox (v.124.0.1). I checked the console and I got this:

Uncaught ReferenceError: TouchEvent is not defined
    Be https://vue-fluid-dnd.netlify.app/_astro/_plugin-vue_export-helper.BrKkVjjl.js:1
    K https://vue-fluid-dnd.netlify.app/_astro/_plugin-vue_export-helper.BrKkVjjl.js:1
    N https://vue-fluid-dnd.netlify.app/_astro/_plugin-vue_export-helper.BrKkVjjl.js:1

I searched a little and apparently I needed to enabled touch events for Firefox. Mainly, this setting

dom.w3c_touch_events.enabled

on the about:config page.

It has 3 states:

0 - disable
1 - enable
2 - auto-detect

In my case, it was in auto-detect but didn't work the TouchEvents, So I changed it to 1 (enable) and it works perfectly.

Perhaps you should include this somewhere in the docs for Firefox users. (also check Safari)

Bests,
Keep up the good work

Not working on firefox

Its trowing this error on console

Uncaught ReferenceError: TouchEvent is not defined  
    be https://vue-fluid-dnd.netlify.app/_astro/_plugin-vue_export-helper.CM-bNX2R.js:1  
    T https://vue-fluid-dnd.netlify.app/_astro/_plugin-vue_export-helper.CM-bNX2R.js:1  
    A https://vue-fluid-dnd.netlify.app/_astro/_plugin-vue_export-helper.CM-bNX2R.js:1  
    le https://vue-fluid-dnd.netlify.app/_astro/_plugin-vue_export-helper.CM-bNX2R.js:1  
    H https://vue-fluid-dnd.netlify.app/_astro/_plugin-vue_export-helper.CM-bNX2R.js:1  
    gt https://vue-fluid-dnd.netlify.app/_astro/_plugin-vue_export-helper.CM-bNX2R.js:1  
    d https://vue-fluid-dnd.netlify.app/_astro/_plugin-vue_export-helper.CM-bNX2R.js:1  
    i https://vue-fluid-dnd.netlify.app/_astro/_plugin-vue_export-helper.CM-bNX2R.js:1  
    ut https://vue-fluid-dnd.netlify.app/_astro/_plugin-vue_export-helper.CM-bNX2R.js:1  
    ut https://vue-fluid-dnd.netlify.app/_astro/_plugin-vue_export-helper.CM-bNX2R.js:1  
    ut https://vue-fluid-dnd.netlify.app/_astro/_plugin-vue_export-helper.CM-bNX2R.js:1  
    i https://vue-fluid-dnd.netlify.app/_astro/_plugin-vue_export-helper.CM-bNX2R.js:1  
    dt https://vue-fluid-dnd.netlify.app/_astro/_plugin-vue_export-helper.CM-bNX2R.js:1  
    Ue https://vue-fluid-dnd.netlify.app/_astro/runtime-core.esm-bundler.BxjKewf9.js:13  
    Oe https://vue-fluid-dnd.netlify.app/_astro/runtime-core.esm-bundler.BxjKewf9.js:13  
    J https://vue-fluid-dnd.netlify.app/_astro/runtime-core.esm-bundler.BxjKewf9.js:13  
    Ue https://vue-fluid-dnd.netlify.app/_astro/runtime-core.esm-bundler.BxjKewf9.js:13  
    Kn https://vue-fluid-dnd.netlify.app/_astro/runtime-core.esm-bundler.BxjKewf9.js:13  
    Kn https://vue-fluid-dnd.netlify.app/_astro/runtime-core.esm-bundler.BxjKewf9.js:13  
    promise callback*kn https://vue-fluid-dnd.netlify.app/_astro/runtime-core.esm-bundler.BxjKewf9.js:13  
    ds https://vue-fluid-dnd.netlify.app/_astro/runtime-core.esm-bundler.BxjKewf9.js:13  
    resolve https://vue-fluid-dnd.netlify.app/_astro/runtime-core.esm-bundler.BxjKewf9.js:13  
    registerDep https://vue-fluid-dnd.netlify.app/_astro/runtime-core.esm-bundler.BxjKewf9.js:13  
    promise callback*registerDep https://vue-fluid-dnd.netlify.app/_astro/runtime-core.esm-bundler.BxjKewf9.js:13  
    ce https://vue-fluid-dnd.netlify.app/_astro/runtime-core.esm-bundler.BxjKewf9.js:13  
    h https://vue-fluid-dnd.netlify.app/_astro/runtime-core.esm-bundler.BxjKewf9.js:13  
    wl https://vue-fluid-dnd.netlify.app/_astro/runtime-core.esm-bundler.BxjKewf9.js:13  
    h https://vue-fluid-dnd.netlify.app/_astro/runtime-core.esm-bundler.BxjKewf9.js:13  
    ne https://vue-fluid-dnd.netlify.app/_astro/runtime-core.esm-bundler.BxjKewf9.js:13  
    b https://vue-fluid-dnd.netlify.app/_astro/runtime-core.esm-bundler.BxjKewf9.js:13  
    run https://vue-fluid-dnd.netlify.app/_astro/runtime-core.esm-bundler.BxjKewf9.js:9  
    update https://vue-fluid-dnd.netlify.app/_astro/runtime-core.esm-bundler.BxjKewf9.js:13  
    P https://vue-fluid-dnd.netlify.app/_astro/runtime-core.esm-bundler.BxjKewf9.js:13  
    ce https://vue-fluid-dnd.netlify.app/_astro/runtime-core.esm-bundler.BxjKewf9.js:13  
    h https://vue-fluid-dnd.netlify.app/_astro/runtime-core.esm-bundler.BxjKewf9.js:13  
    p https://vue-fluid-dnd.netlify.app/_astro/runtime-core.esm-bundler.BxjKewf9.js:13  
    mount https://vue-fluid-dnd.netlify.app/_astro/runtime-core.esm-bundler.BxjKewf9.js:13  
    mount https://vue-fluid-dnd.netlify.app/_astro/client.tihex4gh.js:5  
    vt https://vue-fluid-dnd.netlify.app/_astro/client.tihex4gh.js:5  
    u https://vue-fluid-dnd.netlify.app/example/vertical-list/single-vertical-list-autoscroll/:36  
    e https://vue-fluid-dnd.netlify.app/example/vertical-list/single-vertical-list-autoscroll/:36  
    start https://vue-fluid-dnd.netlify.app/example/vertical-list/single-vertical-list-autoscroll/:36  
    childrenConnectedCallback https://vue-fluid-dnd.netlify.app/example/vertical-list/single-vertical-list-autoscroll/:36  
    e https://vue-fluid-dnd.netlify.app/example/vertical-list/single-vertical-list-autoscroll/:36  
    n https://vue-fluid-dnd.netlify.app/example/vertical-list/single-vertical-list-autoscroll/:36  
    connectedCallback https://vue-fluid-dnd.netlify.app/example/vertical-list/single-vertical-list-autoscroll/:36  
    LifecycleConnectedCallback* https://vue-fluid-dnd.netlify.app/example/vertical-list/single-vertical-list-autoscroll/:36  
    <anonymous> https://vue-fluid-dnd.netlify.app/example/vertical-list/single-vertical-list-autoscroll/:36  
49 _plugin-vue_export-helper.CM-bNX2R.js:1:2620

TouchEvent if you don't have a touch input device connected, which is causing "TouchEvent is not defined" errors:

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.