未验证 提交 f1579794 编写于 作者: O owen-m1 提交者: GitHub

1.8.0-rc1

上级 84d6358c
...@@ -2,15 +2,15 @@ ...@@ -2,15 +2,15 @@
### Issue ### Issue
1. Try [master](https://github.com/RubaXa/Sortable/tree/master/)-branch, perhaps the problem has been solved; 1. Try [master](https://github.com/SortableJS/Sortable/tree/master/)-branch, perhaps the problem has been solved;
2. [Use the search](https://github.com/RubaXa/Sortable/search?type=Issues&q=problem), maybe already have an answer; 2. [Use the search](https://github.com/SortableJS/Sortable/search?type=Issues&q=problem), maybe already have an answer;
3. If not found, create example on [jsbin.com (draft)](http://jsbin.com/zunibaxada/1/edit?html,js,output) and describe the problem. 3. If not found, create example on [jsbin.com (draft)](http://jsbin.com/zunibaxada/1/edit?html,js,output) and describe the problem.
--- ---
### Pull Request ### Pull Request
1. Only into [master](https://github.com/RubaXa/Sortable/tree/master/)-branch. 1. Only into [master](https://github.com/SortableJS/Sortable/tree/master/)-branch.
2. Do not modify `Sortable.min.js`, this will be compiled before each release. 2. Do not modify `Sortable.min.js`, this will be compiled before each release.
### Setup ### Setup
......
## Hi, this project very much requires the maintainer, if you have a chewing and appropriate skills, please [contact me](mailto:ibn@rubaxa.org?subject=Sortable%20vs.%20Maintainer)! #### Problem:
---
#### JSBin/JSFiddle demonstrating the problem:
---
Before you create an issue, check it: Before you create an issue, check it:
1. Try [master](https://github.com/RubaXa/Sortable/tree/master/)-branch, perhaps the problem has been solved; 1. Try [master](https://github.com/SortableJS/Sortable/tree/master/)-branch, perhaps the problem has been solved;
2. [Use the search](https://github.com/RubaXa/Sortable/search?q=problem), maybe already have an answer; 2. [Use the search](https://github.com/SortableJS/Sortable/search?q=problem), maybe we already have an answer;
3. If not found, create an example on [jsbin.com (draft)](http://jsbin.com/vojixek/edit?html,js,output) and describe the problem. 3. If not found, create an example on [jsbin.com (draft)](http://jsbin.com/vojixek/edit?html,js,output) and describe the problem.
Bindings: Bindings:
......
...@@ -34,10 +34,10 @@ Demo: http://sortablejs.github.io/Sortable/ ...@@ -34,10 +34,10 @@ Demo: http://sortablejs.github.io/Sortable/
### Articles ### Articles
* [Swap Thresholds and Direction](https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction) (December 2, 2018)
* [Sortable v1.0 — New capabilities](https://github.com/SortableJS/Sortable/wiki/Sortable-v1.0-—-New-capabilities/) (December 22, 2014) * [Sortable v1.0 — New capabilities](https://github.com/SortableJS/Sortable/wiki/Sortable-v1.0-—-New-capabilities/) (December 22, 2014)
* [Sorting with the help of HTML5 Drag'n'Drop API](https://github.com/SortableJS/Sortable/wiki/Sorting-with-the-help-of-HTML5-Drag'n'Drop-API/) (December 23, 2013) * [Sorting with the help of HTML5 Drag'n'Drop API](https://github.com/SortableJS/Sortable/wiki/Sorting-with-the-help-of-HTML5-Drag'n'Drop-API/) (December 23, 2013)
<br/> <br/>
### Install ### Install
...@@ -79,7 +79,7 @@ You can use any element for the list and its elements, not just `ul`/`li`. Here ...@@ -79,7 +79,7 @@ You can use any element for the list and its elements, not just `ul`/`li`. Here
### Options ### Options
```js ```js
var sortable = new Sortable(el, { var sortable = new Sortable(el, {
group: "name", // or { name: "...", pull: [true, false, clone], put: [true, false, array] } group: "name", // or { name: "...", pull: [true, false, 'clone', array], put: [true, false, array] }
sort: true, // sorting inside list sort: true, // sorting inside list
delay: 0, // time in milliseconds to define when the sorting should start delay: 0, // time in milliseconds to define when the sorting should start
touchStartThreshold: 0, // px, how many pixels the point should move before cancelling a delayed drag event touchStartThreshold: 0, // px, how many pixels the point should move before cancelling a delayed drag event
...@@ -95,6 +95,11 @@ var sortable = new Sortable(el, { ...@@ -95,6 +95,11 @@ var sortable = new Sortable(el, {
dragClass: "sortable-drag", // Class name for the dragging item dragClass: "sortable-drag", // Class name for the dragging item
dataIdAttr: 'data-id', dataIdAttr: 'data-id',
swapThreshold: 1, // Threshold of the swap zone
invertSwap: false, // Will always use inverted swap zone if set to true
invertedSwapThreshold: 1, // Threshold of the inverted swap zone (will be set to swapThreshold value by default)
direction: 'horizontal', // Direction of Sortable (will be detected automatically if not given)
forceFallback: false, // ignore the HTML5 DnD behaviour and force the fallback to kick in forceFallback: false, // ignore the HTML5 DnD behaviour and force the fallback to kick in
fallbackClass: "sortable-fallback", // Class name for the cloned DOM Element when using forceFallback fallbackClass: "sortable-fallback", // Class name for the cloned DOM Element when using forceFallback
...@@ -107,6 +112,8 @@ var sortable = new Sortable(el, { ...@@ -107,6 +112,8 @@ var sortable = new Sortable(el, {
scrollSpeed: 10, // px scrollSpeed: 10, // px
bubbleScroll: true, // apply autoscroll to all parent elements, allowing for easier movement bubbleScroll: true, // apply autoscroll to all parent elements, allowing for easier movement
dragoverBubble: false,
setData: function (/** DataTransfer */dataTransfer, /** HTMLElement*/dragEl) { setData: function (/** DataTransfer */dataTransfer, /** HTMLElement*/dragEl) {
dataTransfer.setData('Text', dragEl.textContent); // `dataTransfer` object of HTML5 DragEvent dataTransfer.setData('Text', dragEl.textContent); // `dataTransfer` object of HTML5 DragEvent
}, },
...@@ -183,7 +190,7 @@ To drag elements from one list into another, both lists must have the same `grou ...@@ -183,7 +190,7 @@ To drag elements from one list into another, both lists must have the same `grou
You can also define whether lists can give away, give and keep a copy (`clone`), and receive elements. You can also define whether lists can give away, give and keep a copy (`clone`), and receive elements.
* name: `String` — group name * name: `String` — group name
* pull: `true|false|["foo", "bar"]|'clone'|function` — ability to move from the list. `clone` — copy the item, rather than move. Or an array of group names which the elements may be put in. * pull: `true|false|["foo", "bar"]|'clone'|function` — ability to move from the list. `clone` — copy the item, rather than move. Or an array of group names which the elements may be put in. Defaults to `true`.
* put: `true|false|["baz", "qux"]|function` — whether elements can be added from other lists, or an array of group names from which elements can be taken. * put: `true|false|["baz", "qux"]|function` — whether elements can be added from other lists, or an array of group names from which elements can be taken.
* revertClone: `boolean` — revert cloned element to initial position after moving to a another list. * revertClone: `boolean` — revert cloned element to initial position after moving to a another list.
...@@ -215,6 +222,53 @@ Demo: https://jsbin.com/zosiwah/edit?js,output ...@@ -215,6 +222,53 @@ Demo: https://jsbin.com/zosiwah/edit?js,output
--- ---
#### `swapThreshold` option
Percentage of the target that the swap zone will take up, as a float between `0` and `1`.
Read more: https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction#swap-threshold
---
#### `invertSwap` option
Set to `true` to set the swap zone to the sides of the target, for the effect of sorting "in between" items.
Read more: https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction#forcing-inverted-swap-zone
---
#### `invertedSwapThreshold` option
Percentage of the target that the inverted swap zone will take up, as a float between `0` and `1`. If not given, will default to `swapThreshold`.
Read more: https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction#dealing-with-swap-glitching
---
#### `direction` option
Direction that the Sortable should sort in. Can be set to `'vertical'`, `'horizontal'`, or a function, which will be called whenever a target is dragged over. Must return `'vertical'` or `'horizontal'`.
Read more: https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction#direction
Example of dynamic direction detection:
```js
Sortable.create(el, {
direction: function(evt, target, dragEl) {
return Sortable.utils.detectDirection(el);
}
});
```
---
#### `touchStartThreshold` option #### `touchStartThreshold` option
This option is similar to `fallbackTolerance` option. This option is similar to `fallbackTolerance` option.
...@@ -413,6 +467,14 @@ Demo: https://jsbin.com/kesewor/edit?html,js,output ...@@ -413,6 +467,14 @@ Demo: https://jsbin.com/kesewor/edit?html,js,output
--- ---
#### `dragoverBubble` option
If set to `true`, the dragover event will bubble to parent Sortables. Useful for nested Sortables. Works on both fallback and native dragover event.
---
### Event object ([demo](https://jsbin.com/fogujiv/edit?js,output)) ### Event object ([demo](https://jsbin.com/fogujiv/edit?js,output))
- to:`HTMLElement` — list, in which moved element. - to:`HTMLElement` — list, in which moved element.
...@@ -576,6 +638,7 @@ Link to the active instance. ...@@ -576,6 +638,7 @@ Link to the active instance.
* closest(el`:HTMLElement`, selector`:String`[, ctx`:HTMLElement`])`:HTMLElement|Null` — for each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree * closest(el`:HTMLElement`, selector`:String`[, ctx`:HTMLElement`])`:HTMLElement|Null` — for each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree
* clone(el`:HTMLElement`)`:HTMLElement` — create a deep copy of the set of matched elements * clone(el`:HTMLElement`)`:HTMLElement` — create a deep copy of the set of matched elements
* toggleClass(el`:HTMLElement`, name`:String`, state`:Boolean`) — add or remove one classes from each element * toggleClass(el`:HTMLElement`, name`:String`, state`:Boolean`) — add or remove one classes from each element
* detectDirection(el`:HTMLElement`)`:String` — automatically detect the direction of the element as either `'vertical'` or `'horizontal'`
--- ---
...@@ -636,9 +699,6 @@ Please, [read this](CONTRIBUTING.md). ...@@ -636,9 +699,6 @@ Please, [read this](CONTRIBUTING.md).
## MIT LICENSE ## MIT LICENSE
Copyright 2013-2017 Lebedev Konstantin <ibnRubaXa@gmail.com>
http://SortableJS.github.io/Sortable/
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including "Software"), to deal in the Software without restriction, including
......
此差异已折叠。
此差异已折叠。
...@@ -3,9 +3,10 @@ ...@@ -3,9 +3,10 @@
"main": [ "main": [
"Sortable.js" "Sortable.js"
], ],
"homepage": "http://rubaxa.github.io/Sortable/", "homepage": "http://SortableJS.github.io/Sortable/",
"authors": [ "authors": [
"RubaXa <ibnRubaXa@gmail.com>" "RubaXa <ibnRubaXa@gmail.com>",
"owenm <owen23355@gmail.com>"
], ],
"description": "Minimalist library for reorderable drag-and-drop lists on modern browsers and touch devices. No jQuery.", "description": "Minimalist library for reorderable drag-and-drop lists on modern browsers and touch devices. No jQuery.",
"keywords": [ "keywords": [
......
{ {
"name": "Sortable", "name": "Sortable",
"main": "Sortable.js", "main": "Sortable.js",
"version": "1.7.0", "version": "1.8.0-rc1",
"homepage": "http://rubaxa.github.io/Sortable/", "homepage": "http://SortableJS.github.io/Sortable/",
"repo": "RubaXa/Sortable", "repo": "SortableJS/Sortable",
"authors": [ "authors": [
"RubaXa <ibnRubaXa@gmail.com>" "RubaXa <ibnRubaXa@gmail.com>",
"owenm <owen23355@gmail.com>"
], ],
"description": "Minimalist library for reorderable drag-and-drop lists on modern browsers and touch devices. No jQuery.", "description": "Minimalist library for reorderable drag-and-drop lists on modern browsers and touch devices. No jQuery.",
"keywords": [ "keywords": [
......
{ {
"name": "sortablejs", "name": "sortablejs",
"exportName": "Sortable", "exportName": "Sortable",
"version": "1.7.0", "version": "1.8.0-rc1",
"devDependencies": { "devDependencies": {
"grunt": "*", "grunt": "*",
"grunt-contrib-jshint": "*", "grunt-contrib-jshint": "*",
...@@ -18,9 +18,13 @@ ...@@ -18,9 +18,13 @@
"prepublish": "./node_modules/grunt/bin/grunt", "prepublish": "./node_modules/grunt/bin/grunt",
"http-server": "http-server -s ./" "http-server": "http-server -s ./"
}, },
"contributors" : [
"Konstantin Lebedev <ibnRubaXa@gmail.com>",
"Owen Mills <owen23355@gmail.com>"
],
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git://github.com/rubaxa/Sortable.git" "url": "git://github.com/SortableJS/Sortable.git"
}, },
"files": [ "files": [
"Sortable.js", "Sortable.js",
...@@ -34,9 +38,9 @@ ...@@ -34,9 +38,9 @@
"angular", "angular",
"ng-sortable", "ng-sortable",
"react", "react",
"vue",
"mixin" "mixin"
], ],
"author": "Konstantin Lebedev <ibnRubaXa@gmail.com>",
"license": "MIT", "license": "MIT",
"spm": { "spm": {
"main": "Sortable.js", "main": "Sortable.js",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册