sortablejs 1.8.1 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/Sortable.js +337 -214
- package/Sortable.min.js +2 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -3,6 +3,7 @@ Sortable is a JavaScript library for reorderable drag-and-drop lists.
|
|
|
3
3
|
|
|
4
4
|
Demo: http://sortablejs.github.io/Sortable/
|
|
5
5
|
|
|
6
|
+
Supported by [<img width="100px" src="https://user-images.githubusercontent.com/30704531/53353702-51143d00-38f3-11e9-8fe3-bff9fcf96bcd.png">](https://www.browserstack.com/)
|
|
6
7
|
|
|
7
8
|
## Features
|
|
8
9
|
|
|
@@ -83,6 +84,7 @@ var sortable = new Sortable(el, {
|
|
|
83
84
|
group: "name", // or { name: "...", pull: [true, false, 'clone', array], put: [true, false, array] }
|
|
84
85
|
sort: true, // sorting inside list
|
|
85
86
|
delay: 0, // time in milliseconds to define when the sorting should start
|
|
87
|
+
delayOnTouchOnly: false, // only delay if user is using touch
|
|
86
88
|
touchStartThreshold: 0, // px, how many pixels the point should move before cancelling a delayed drag event
|
|
87
89
|
disabled: false, // Disables the sortable if set to true.
|
|
88
90
|
store: null, // @see Store
|
|
@@ -145,6 +147,10 @@ var sortable = new Sortable(el, {
|
|
|
145
147
|
evt.from; // previous list
|
|
146
148
|
evt.oldIndex; // element's old index within old parent
|
|
147
149
|
evt.newIndex; // element's new index within new parent
|
|
150
|
+
evt.oldDraggableIndex; // element's old index within old parent, only counting draggable elements
|
|
151
|
+
evt.newDraggableIndex; // element's new index within new parent, only counting draggable elements
|
|
152
|
+
evt.clone // the clone element
|
|
153
|
+
evt.pullMode; // when item is in another sortable: `"clone"` if cloning, `true` if moving
|
|
148
154
|
},
|
|
149
155
|
|
|
150
156
|
// Element is dropped into the list from another list
|
|
@@ -234,6 +240,7 @@ Demo: https://jsbin.com/jayedig/edit?js,output
|
|
|
234
240
|
|
|
235
241
|
#### `delay` option
|
|
236
242
|
Time in milliseconds to define when the sorting should start.
|
|
243
|
+
Unfortunately, due to browser restrictions, delaying is not possible on IE or Edge with native drag & drop.
|
|
237
244
|
|
|
238
245
|
Demo: https://jsbin.com/zosiwah/edit?js,output
|
|
239
246
|
|
|
@@ -241,6 +248,13 @@ Demo: https://jsbin.com/zosiwah/edit?js,output
|
|
|
241
248
|
---
|
|
242
249
|
|
|
243
250
|
|
|
251
|
+
#### `delayOnTouchOnly` option
|
|
252
|
+
Whether or not the delay should be applied only if the user is using touch (eg. on a mobile device). No delay will be applied in any other case. Defaults to `false`.
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
|
|
244
258
|
#### `swapThreshold` option
|
|
245
259
|
Percentage of the target that the swap zone will take up, as a float between `0` and `1`.
|
|
246
260
|
|
|
@@ -527,6 +541,9 @@ Demo: https://jsbin.com/becavoj/edit?js,output
|
|
|
527
541
|
- clone:`HTMLElement`
|
|
528
542
|
- oldIndex:`Number|undefined` — old index within parent
|
|
529
543
|
- newIndex:`Number|undefined` — new index within parent
|
|
544
|
+
- oldDraggableIndex: `Number|undefined` — old index within parent, only counting draggable elements
|
|
545
|
+
- newDraggableIndex: `Number|undefined` — new index within parent, only counting draggable elements
|
|
546
|
+
- pullMode:`String|Boolean|undefined` — Pull mode if dragging into another sortable (`"clone"`, `true`, or `false`), otherwise undefined
|
|
530
547
|
|
|
531
548
|
|
|
532
549
|
#### `move` event object
|