All Projects → manishjanky → ngx-sortable

manishjanky / ngx-sortable

Licence: MIT license
ngx-sortable is an angular sortable list components that support drag and drop sorting

Programming Languages

typescript
32286 projects
HTML
75241 projects
SCSS
7915 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to ngx-sortable

React Sortable Hoc
A set of higher-order components to turn any list into an animated, accessible and touch-friendly sortable list✌️
Stars: ✭ 9,747 (+51200%)
Mutual labels:  sorting, drag-and-drop, sortable
Jquery Sortablejs
A jQuery binding for SortableJS
Stars: ✭ 94 (+394.74%)
Mutual labels:  drag-and-drop, sortable
Vue Smooth Dnd
Vue wrapper components for smooth-dnd
Stars: ✭ 1,121 (+5800%)
Mutual labels:  drag-and-drop, sortable
Angular Skyhook
An implementation of react-dnd for Angular.
Stars: ✭ 146 (+668.42%)
Mutual labels:  drag-and-drop, sortable
svelte-dragdroplist
Sortable lists with Svelte 3. Animated, touch-friendly, and accessible.
Stars: ✭ 100 (+426.32%)
Mutual labels:  drag-and-drop, sortable-lists
React Movable
🔀 Drag and drop for your React lists and tables. Accessible. Tiny.
Stars: ✭ 1,064 (+5500%)
Mutual labels:  drag-and-drop, sortable
React Smooth Dnd
react wrapper components for smooth-dnd
Stars: ✭ 1,560 (+8110.53%)
Mutual labels:  drag-and-drop, sortable
React Sortable Tree
Drag-and-drop sortable component for nested data and hierarchies
Stars: ✭ 4,348 (+22784.21%)
Mutual labels:  drag-and-drop, sortable
Easy Dnd
A drag and drop implementation for Vue.js 2 https://codesandbox.io/s/easy-dnd-demo-9mbij https://codesandbox.io/s/easy-dnd-demo-2-xnqbz
Stars: ✭ 202 (+963.16%)
Mutual labels:  drag-and-drop, sortable
Ngx Dnd
🕶 Drag, Drop and Sorting Library for Angular2 and beyond!
Stars: ✭ 511 (+2589.47%)
Mutual labels:  sorting, drag-and-drop
Table Dragger
Turn your old table to drag-and-drop table with columns and rows sorting like magic!
Stars: ✭ 704 (+3605.26%)
Mutual labels:  sorting, sortable
Dragact
a dragger layout system with React style .
Stars: ✭ 710 (+3636.84%)
Mutual labels:  drag-and-drop, sortable
React Beautiful Dnd
Beautiful and accessible drag and drop for lists with React
Stars: ✭ 25,810 (+135742.11%)
Mutual labels:  drag-and-drop, sortable
Yii2 Sortable Widgets
🍨 Rubaxa/Sortable for Yii2
Stars: ✭ 54 (+184.21%)
Mutual labels:  drag-and-drop, sortable
Sortable
Reorderable drag-and-drop lists for modern browsers and touch devices. No jQuery or framework required.
Stars: ✭ 23,641 (+124326.32%)
Mutual labels:  drag-and-drop, sortable
Lean Mean Drag And Drop
Drag&Drop Sorting and Reordering script for complex nested structures
Stars: ✭ 107 (+463.16%)
Mutual labels:  drag-and-drop, sortable
React Native Drag Sort
🔥🔥🔥Drag and drop sort control for react-native
Stars: ✭ 397 (+1989.47%)
Mutual labels:  drag-and-drop, sortable
Smooth Dnd
drag and drop library for javascript
Stars: ✭ 408 (+2047.37%)
Mutual labels:  drag-and-drop, sortable
Ngx Smooth Dnd
angular wrapper for smooth-dnd
Stars: ✭ 152 (+700%)
Mutual labels:  drag-and-drop, sortable
Muuri React
The layout engine for React
Stars: ✭ 163 (+757.89%)
Mutual labels:  sorting, drag-and-drop

ngx-sortable

GitHub license npm Codecov branch npm GitHub top language GitHub code size in bytes GitHub issues GitHub closed issues GitHub contributors

ngx-sortable an angular 4 and above component for sorting list supporting drag and drop sort.

Features

  • Custom template
  • Customizable
  • Drag and drop sorting
  • Use keyboard to sort
  • Remove elements

Examples

Installation

  • npm install ngx-sortable

Using with webpack and tsc builds/ angular-cli builds

  • import NgxSortableModule into your app.module;
import { NgxSortableModule } from 'ngx-sortable'
  • add NgxSortableModule to the imports of your NgModule:
@NgModule({
  imports: [
    ...,
    NgxSortableModule
  ],
  ...
})
class YourModule { ... }
  • use <ngx-sortable></ngx-sortable> in your templates to add sortable list in your view

Deprecated

    <ngx-sortable [items]="items" [name]="'List'" (listSorted)="listOrderChanged($event)">
        <ng-template let-item>
            <div class="sortable-list-item">
                {{item}}
            </div>
        </ng-template>
    </ngx-sortable>

v2.0.0 onwards use below

    <ngx-sortable [items]="items" [name]="'List'" (listSorted)="listOrderChanged($event)">
        <ng-template let-item="item">
            <div class="sortable-list-item">
                {{item}}
            </div>
        </ng-template>
    </ngx-sortable>

Where content inside <ng-template> </ng-template> is the template that will be used for displaying list items. Also the class can be named accordingly this is just an example. Create a class and add it to your root style.css

Notice the difference in accessing the item in above two examples. Also from v2.0.0 onwards index of the item is also available in the template similar to let-item="item" use let-i="index" and i will be the index variable available in the template.

Config

Input

  • items: any[] - array of list items.
  • name: string - List name that will be shown in the header.
  • listStyle: any - list styles such as height, width.
  • showHeader: boolean - flag to hide / show header default is true
  • removeOnDropOutside: boolean - flag to enable remove items by dragging and dropping them outside the list. Default is false
  • arrowKeySort: boolean - flag to enable sort using keyboard arrow keys. Example: Ctrl + ArrowDown moves item down
  • commandKey: CommandKey - key type to use along with arrow keys for sorting e.g. ctrlKey/altKey. Default is ctrlKey
enum CommandKey {
  CtrlKey = "ctrlKey",
  ShiftKey = "shiftKey",
  Altkey = "altKey",
  MetaKey = "metaKey",
}
listStyle = {
        width:'300px', //width of the list defaults to 300
        height: '250px', //height of the list defaults to 250
      }

Output

  • listSorted($event): Event - when list is sorted emits listSorted event with updated order

Where $event is the sorted list

  • dragStart($event): Event - emitted when an item is seleceted and starts dragging

Where $event:{ event: Javascript event, itemIndex: current item index, newIndex: -1, item: selected item}

  • dropped($event): Event - emitted when an item is dropped at the new index

Where $event:{ event: Javascript event, itemIndex: current item index, newIndex: new item index, item: selected item}

  • moveDown($event): Event - emitted when an item is moved down in the list using the sort arrows

Where $event:{ itemIndex: current item index, newIndex: new item index, item: selected item}

  • moveUp($event): Event - emitted when an item is moved up in the list using sort arrows

Where $event:{ itemIndex: current item index, newIndex: new item index, item: selected item}

  • remove($event): Event - emitted when an item is removed from the list by dropping out, only works when removeOnDropOutside is set to true

Where $event:{ itemIndex: current item index, item: selected item}

Help Improve

Found a bug or an issue with this? Open a new issue here on GitHub.

Contributing to this project

Anyone and everyone is welcome to contribute. Please take a moment to review the guidelines for contributing.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].