angular-sortablejs
Advanced tools
Comparing version 1.3.1 to 1.3.2
import { ElementRef, OnInit, OnChanges, OnDestroy, NgZone, SimpleChanges } from '@angular/core'; | ||
import { FormArray } from '@angular/forms'; | ||
import { SortablejsOptions } from './sortablejs-options'; | ||
@@ -7,3 +6,3 @@ export declare class SortablejsDirective implements OnInit, OnChanges, OnDestroy { | ||
private zone; | ||
items: any[] | FormArray; | ||
items: any[] | any; | ||
inputOptions: SortablejsOptions; | ||
@@ -19,3 +18,4 @@ private _sortable; | ||
private readonly bindingEnabled; | ||
private readonly isItemsFormArray; | ||
private readonly overridenOptions; | ||
} |
"use strict"; | ||
var core_1 = require('@angular/core'); | ||
var forms_1 = require('@angular/forms'); | ||
var sortablejs_module_1 = require('./sortablejs.module'); | ||
@@ -67,2 +66,12 @@ // Sortable | ||
}); | ||
Object.defineProperty(SortablejsDirective.prototype, "isItemsFormArray", { | ||
// we need this to identify that the input is a FormArray | ||
// we don't want to have a dependency on @angular/forms just for that | ||
get: function () { | ||
// just checking for random FormArray methods not available on a standard array | ||
return !!this.items.at && !!this.items.insert && !!this.items.reset; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(SortablejsDirective.prototype, "overridenOptions", { | ||
@@ -77,3 +86,3 @@ get: function () { | ||
onremove = function (item) { | ||
if (_this.items instanceof forms_1.FormArray) { | ||
if (_this.isItemsFormArray) { | ||
_this.items.insert(event.newIndex, item); | ||
@@ -91,3 +100,3 @@ } | ||
var item = void 0; | ||
if (_this.items instanceof forms_1.FormArray) { | ||
if (_this.isItemsFormArray) { | ||
item = _this.items.at(event.oldIndex); | ||
@@ -106,3 +115,3 @@ _this.items.removeAt(event.oldIndex); | ||
if (_this.bindingEnabled) { | ||
if (_this.items instanceof forms_1.FormArray) { | ||
if (_this.isItemsFormArray) { | ||
var relocated = _this.items.at(event.oldIndex); | ||
@@ -109,0 +118,0 @@ _this.items.removeAt(event.oldIndex); |
{ | ||
"name": "angular-sortablejs", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "SortableJS for Angular 2+", | ||
@@ -37,7 +37,6 @@ "main": "./dist/index.js", | ||
"dependencies": { | ||
"@angular/core": "^2.0.0", | ||
"@angular/forms": "^2.0.0", | ||
"sortablejs": "^1.4.2" | ||
}, | ||
"devDependencies": { | ||
"@angular/core": "^2.0.0", | ||
"@angular/compiler": "^2.1.0", | ||
@@ -55,2 +54,5 @@ "@angular/compiler-cli": "^2.1.0", | ||
}, | ||
"peerDependencies": { | ||
"@angular/core": "^2.0.0" | ||
}, | ||
"files": [ | ||
@@ -57,0 +59,0 @@ "dist/" |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25212
2
231
12
+ Addedsortablejs@1.15.5(transitive)
- Removed@angular/core@^2.0.0
- Removed@angular/forms@^2.0.0
- Removed@angular/common@2.4.10(transitive)
- Removed@angular/forms@2.4.10(transitive)
- Removedsortablejs@1.15.4(transitive)