1.1.0 • Published 6 years ago

aurelia-sortablejs v1.1.0

Weekly downloads
63
License
MIT
Repository
github
Last release
6 years ago

Build Status

aurelia-sortablejs

Aurelia plugin to use the sortablejs library.

Installation

Aurelia-CLI (RequireJS)

Install the package:

au install aurelia-sortablejs

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();
  }

Aurelia-CLI (SystemJS)

Install the package:

au install aurelia-sortablejs

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();
  }

Aurelia-CLI (Webpack)

Install the package:

yarn add aurelia-sortablejs

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

export function configure(aurelia: Aurelia) {
  aurelia.use
    .standardConfiguration()
    .feature(PLATFORM.moduleName('resources'))
+   .plugin(PLATFORM.moduleName('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

AttributeSortablejs eventDescription
sortable-addonAddElement is dropped into the list from another list
sortable-endonEndDragging ended
sortable-filteronFilterAttempt to drag a filtered element
sortable-moveonMoveEvent when you move an item in the list or between lists
sortable-removeonRemoveElement is removed from the list into another list
sortable-sortonSortCalled by any change to the list (add / update / remove)
sortable-startonStartDragging started
sortable-updateonUpdateChanged sorting within list
1.1.0

6 years ago

1.0.0

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago