angular-ui-sortable-multiselection
Advanced tools
Comparing version 0.5.0 to 0.6.0
{ | ||
"name": "angular-ui-sortable-multiselection", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "This directive allows multiple element sorting in UI-Sortable.", | ||
@@ -5,0 +5,0 @@ "author": "https://github.com/thgreasi/ui-sortable-multiselection/graphs/contributors", |
{ | ||
"name": "angular-ui-sortable-multiselection", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "This directive allows multiple element sorting in UI-Sortable.", | ||
@@ -5,0 +5,0 @@ "author": "https://github.com/thgreasi/ui-sortable-multiselection/graphs/contributors", |
@@ -16,4 +16,32 @@ ui-sortable-multiselection | ||
[MultiSelect on Click Demo pen](http://codepen.io/thgreasi/pen/KgoPmY) | ||
## ui.item.sortableMultiSelect API documentation | ||
### Allow multi-selection on click | ||
For better touch device support, use the option 'multiSelectOnClick'. This will allow click/tap to select and deselect individual items instead of requiring a modifier key to be held down. | ||
Example usage: | ||
```javascript | ||
// set the sortable options | ||
$scope.sortableOptions = uiSortableMultiSelectionMethods.extendOptions({ | ||
'multiSelectOnClick': true, | ||
start: function() { | ||
// ... | ||
}, | ||
stop: function() { | ||
// ... | ||
} | ||
}); | ||
``` | ||
```html | ||
<ul class="sortable-list" ui-sortable="sortableOptions" ng-model="items"> | ||
<li ng-repeat="item in items" class="sortable-item" ui-sortable-selectable> | ||
<div class="sortable-item__inner">{item.name}</div> | ||
</li> | ||
</ul> | ||
``` | ||
The `ui` argument of the available callbacks gets enriched with some extra properties as specified below: | ||
@@ -20,0 +48,0 @@ |
@@ -12,3 +12,7 @@ angular.module('ui.sortable.multiselection', []) | ||
var $parent = $this.parent(); | ||
var multiSelectOnClick = $parent.sortable('option', 'multiSelectOnClick') || false; | ||
var isDisabled = $parent.sortable('option', 'disabled'); | ||
if (isDisabled){ | ||
@@ -28,3 +32,3 @@ return; | ||
var validHandle = false; | ||
$parent.find(jquerySortableHandleOption).find('*').addBack().each(function () { | ||
@@ -46,3 +50,3 @@ if (this === e.target) { | ||
if (e.ctrlKey || e.metaKey) { | ||
if (e.ctrlKey || e.metaKey || multiSelectOnClick) { | ||
$this.toggleClass(selectedItemClass); | ||
@@ -274,3 +278,3 @@ } else if (e.shiftKey && lastIndex !== undefined && lastIndex >= 0) { | ||
var draggedModel = ngModel[newPosition]; | ||
// get the models and remove them from the list | ||
@@ -280,3 +284,3 @@ // the code should run in reverse order, | ||
var models = extractGroupedModelsFromIndexes(ngModel, indexes.above, indexes.below); | ||
// add the models to the list | ||
@@ -283,0 +287,0 @@ Array.prototype.splice.apply( |
28136
468
74