🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

angular-ui-sortable-multiselection

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-ui-sortable-multiselection - npm Package Compare versions

Comparing version

to
0.4.0

demo/demo-handle.html

2

bower.json
{
"name": "angular-ui-sortable-multiselection",
"version": "0.3.1",
"version": "0.4.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",

@@ -1,2 +0,6 @@

var myapp = angular.module('sortableApp', ['ui.sortable', 'ui.sortable.multiselection']);
var myapp = angular.module('sortableApp', ['ui.sortable', 'ui.sortable.multiselection'], function ($compileProvider) {
if (typeof $compileProvider.debugInfoEnabled === 'function') {
$compileProvider.debugInfoEnabled(false);
}
});

@@ -3,0 +7,0 @@

@@ -1,4 +0,7 @@

var myapp = angular.module('sortableApp', ['ui.sortable', 'ui.sortable.multiselection']);
var myapp = angular.module('sortableApp', ['ui.sortable', 'ui.sortable.multiselection'], function ($compileProvider) {
if (typeof $compileProvider.debugInfoEnabled === 'function') {
$compileProvider.debugInfoEnabled(false);
}
});
myapp.controller('sortableController', function ($scope, uiSortableMultiSelectionMethods) {

@@ -5,0 +8,0 @@ var tmpList = [];

{
"name": "angular-ui-sortable-multiselection",
"version": "0.3.1",
"version": "0.4.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",

ui-sortable-multiselection
==========================
[![npm](https://img.shields.io/npm/dm/angular-ui-sortable-multiselection.svg)](https://www.npmjs.com/package/angular-ui-sortable-multiselection)
[![npm](https://img.shields.io/npm/dm/angular-ui-sortable-multiselection.svg)](https://www.npmjs.com/package/angular-ui-sortable-multiselection)
[![debugInfoEnabled(false) Ready Badge](https://rawgit.com/thgreasi/ng-debugInfoDisabled-badges/master/badge1.svg)](https://docs.angularjs.org/guide/production#disabling-debug-data)

@@ -11,2 +12,4 @@ Provide multiple element sorting in [UI-Sortable](https://github.com/angular-ui/ui-sortable)

[Handle Demo pen](http://codepen.io/feus4177/pen/zvWvpY)
## ui.item.sortableMultiSelect API documentation

@@ -13,0 +16,0 @@

@@ -13,2 +13,3 @@ angular.module('ui.sortable.multiselection', [])

var jquerySortableCancelOption = $parent.sortable('option', 'cancel');
var jquerySortableHandleOption = $parent.sortable('option', 'handle');

@@ -20,6 +21,20 @@ // Respect jQuery UI Sortable's cancel property by testing if element matches selector

var parentScope = $parent.scope();
parentScope.sortableMultiSelect = parentScope.sortableMultiSelect || {};
// Mimic jQuery UI Sortable's handle property when determining if an item is selected
if (jquerySortableHandleOption) {
var validHandle = false;
$parent.find(jquerySortableHandleOption).find('*').addBack().each(function () {
if (this === e.target) {
validHandle = true;
}
});
var lastIndex = parentScope.sortableMultiSelect.lastIndex;
if (!validHandle) {
return;
}
}
var sortableMultiSelectState = $parent.data('uiSortableMultiSelectionState') || {};
var lastIndex = sortableMultiSelectState.lastIndex;
var index = $this.index();

@@ -39,4 +54,12 @@

}
parentScope.sortableMultiSelect.lastIndex = index;
sortableMultiSelectState.lastIndex = index;
$parent.data('uiSortableMultiSelectionState', sortableMultiSelectState);
$parent.trigger('ui-sortable-selectionschanged');
});
element.parent().on('$destroy', function() {
console.log('destroy');
element.parent().removeData('uiSortableMultiSelectionState');
});
}

@@ -181,20 +204,16 @@ };

if (!ui.item.sortable.isCanceled()) {
var scope = ui.item.sortable.droptarget.scope();
var ngModel = ui.item.sortable.droptargetModel,
newPosition = ui.item.sortable.dropindex,
models = ui.item.sortableMultiSelect.moved;
scope.$apply(function () {
var ngModel = ui.item.sortable.droptargetModel,
newPosition = ui.item.sortable.dropindex,
models = ui.item.sortableMultiSelect.moved;
// add the models to the target list
Array.prototype.splice.apply(
ngModel,
[newPosition+ 1, 0]
.concat(models.below));
// add the models to the target list
Array.prototype.splice.apply(
ngModel,
[newPosition+ 1, 0]
.concat(models.below));
Array.prototype.splice.apply(
ngModel,
[newPosition, 0]
.concat(models.above));
});
Array.prototype.splice.apply(
ngModel,
[newPosition, 0]
.concat(models.above));
} else {

@@ -207,15 +226,11 @@ ui.item.sortableMultiSelect.sourceElement.find('> .' + selectedItemClass).show();

if (!ui.item.sortable.isCanceled()) {
var scope = ui.item.sortableMultiSelect.sourceElement.scope();
var ngModel = ui.item.sortable.sourceModel,
oldPosition = ui.item.sortable.index;
scope.$apply(function () {
var ngModel = ui.item.sortable.sourceModel,
oldPosition = ui.item.sortable.index;
var indexes = groupIndexes(ui.item.sortableMultiSelect.indexes, oldPosition);
var indexes = groupIndexes(ui.item.sortableMultiSelect.indexes, oldPosition);
// get the models and remove them from the original list
// the code should run in reverse order,
// so that the indexes will not break
ui.item.sortableMultiSelect.moved = extractGroupedModelsFromIndexes(ngModel, indexes.above, indexes.below);
});
// get the models and remove them from the original list
// the code should run in reverse order,
// so that the indexes will not break
ui.item.sortableMultiSelect.moved = extractGroupedModelsFromIndexes(ngModel, indexes.above, indexes.below);
} else {

@@ -222,0 +237,0 @@ ui.item.sortableMultiSelect.sourceElement.find('> .' + selectedItemClass).show();

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet