GithubHelp home page GithubHelp logo

eriklieben / aurelia-sortablejs Goto Github PK

View Code? Open in Web Editor NEW
8.0 3.0 6.0 571 KB

Aurelia plugin to use sortablejs https://github.com/RubaXa/Sortable

License: MIT License

JavaScript 78.84% TypeScript 21.16%
aurelia-plugins sortablejs

aurelia-sortablejs's Introduction

aurelia-sortablejs

Aurelia plugin to use the sortablejs library.

Installation

JSPM

Install the package:

jspm i aurelia-sortablejs

Add the following line to src/main.js or src/main.ts:

export function configure(aurelia) {
  aurelia.use
    .standardConfiguration()
    .developmentLogging()
+    .plugin("aurelia-sortablejs");

Aurelia-CLI

Install the package:

npm i aurelia-sortablejs sortablejs --save

Open up the file aurelia_project/aurelia.json and add the following in the bundles, vender-bundle.js dependencies section:

{
  "name": "sortablejs",
  "path": "../node_modules/sortablejs/",
  "main": "sortable"
},
{
  "name": "aurelia-sortablejs",
  "path": "../node_modules/aurelia-sortablejs/dist/amd",
  "main": "index"
},

Add the following line to src/main.js or src/main.ts:

export function configure(aurelia: Aurelia) {
  aurelia.use
    .standardConfiguration()
    .feature('resources')
+    .plugin('aurelia-sortablejs');

  if (environment.debug) {
    aurelia.use.developmentLogging();
  }

Usage:

<ul sortable.bind="options">
  <li>one</li>
  <li>two</li>
  <li>three</li>
</ul>

Each event can be used in the following way:

<ul sortable.bind="options" sortable-move.delegate="func($event)">
  <li>one</li>
  <li>two</li>
  <li>three</li>
</ul>
export class Home {
  public func(customEvent: CustomEvent) {
    let event = customEvent.detail;
    console.log("event", event);
  }
}

sortable

The following attributes can be set to catch events

Attribute Sortablejs event Description
sortable-add onAdd Element is dropped into the list from another list
sortable-end onEnd Dragging ended
sortable-filter onFilter Attempt to drag a filtered element
sortable-move onMove Event when you move an item in the list or between lists
sortable-remove onRemove Element is removed from the list into another list
sortable-sort onSort Called by any change to the list (add / update / remove)
sortable-start onStart Dragging started
sortable-update onUpdate Changed sorting within list

aurelia-sortablejs's People

Contributors

azure-pipelines[bot] avatar erik-lieben avatar koltesdigital avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

aurelia-sortablejs's Issues

File is not bundled

I'm using the Aurelia CLI and my app is failing in production because node_modules\aurelia-sortablejs\dist\amd\sortable.js is missing. So apparently it's not being bundled up for some reason. I've added the folders and file in my production directory as a workaround.

Aurelia Bundle (jspm) do not include sortable.js

Hi, nice helper, only the bundle do not include the following file.

My configuration:

module.exports = {
  "bundles": {
    "dist/app-libs": {
      "includes": [
        "aurelia-framework",
         ...
         
        "sortablejs",
        "aurelia-sortablejs"
      ],
      "options": {
        "inject": true,
        "minify": true,
        "depCache": false,
        "rev": true
      }
    }
  }
};

The /jspm_packages/npm/[email protected]/sortable.js is still loading separate.

image

Best regards,
George

SortableJS onChoose event missing

I'm submitting a feature request

The sortablejs onChoose event is missing. Can you please add it so we don't have to apply it through the options object?

Great plugin by the way.

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.