angular-sortablejs
Advanced tools
Comparing version 1.2.0 to 1.2.1
{ | ||
"name": "angular-sortablejs", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "SortableJS for Angular 2+", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -11,5 +11,5 @@ "use strict"; | ||
}; | ||
var core_1 = require('@angular/core'); | ||
var forms_1 = require('@angular/forms'); | ||
var index_1 = require('../index'); | ||
var core_1 = require("@angular/core"); | ||
var forms_1 = require("@angular/forms"); | ||
var index_1 = require("../index"); | ||
// Sortable | ||
@@ -31,3 +31,2 @@ var Sortable = require('sortablejs'); | ||
var _this = this; | ||
// onChange??? | ||
if (this.runInsideAngular) { | ||
@@ -71,8 +70,18 @@ this._sortable = new Sortable(this.element.nativeElement, this.options); | ||
}; | ||
Object.defineProperty(SortablejsDirective.prototype, "bindingEnabled", { | ||
// returns whether the items are currently set | ||
get: function () { | ||
return !!this._items; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(SortablejsDirective.prototype, "overridenOptions", { | ||
get: function () { | ||
var _this = this; | ||
if (this._items) { | ||
return { | ||
onAdd: function (event) { | ||
// always intercept standard events but act only in case _items are set (bindingEnabled) | ||
// allows to forget about tracking this._items changes | ||
return { | ||
onAdd: function (event) { | ||
if (_this.bindingEnabled) { | ||
onremove = function (item) { | ||
@@ -86,6 +95,8 @@ if (_this._items instanceof forms_1.FormArray) { | ||
}; | ||
_this.proxyEvent('onAdd', event); | ||
}, | ||
onRemove: function (event) { | ||
var item; | ||
} | ||
_this.proxyEvent('onAdd', event); | ||
}, | ||
onRemove: function (event) { | ||
if (_this.bindingEnabled) { | ||
var item = void 0; | ||
if (_this._items instanceof forms_1.FormArray) { | ||
@@ -100,5 +111,7 @@ item = _this._items.at(event.oldIndex); | ||
onremove = null; | ||
_this.proxyEvent('onRemove', event); | ||
}, | ||
onUpdate: function (event) { | ||
} | ||
_this.proxyEvent('onRemove', event); | ||
}, | ||
onUpdate: function (event) { | ||
if (_this.bindingEnabled) { | ||
if (_this._items instanceof forms_1.FormArray) { | ||
@@ -112,7 +125,6 @@ var relocated = _this._items.at(event.oldIndex); | ||
} | ||
_this.proxyEvent('onUpdate', event); | ||
} | ||
}; | ||
} | ||
return {}; | ||
_this.proxyEvent('onUpdate', event); | ||
} | ||
}; | ||
}, | ||
@@ -122,23 +134,23 @@ enumerable: true, | ||
}); | ||
__decorate([ | ||
core_1.Input('sortablejs'), | ||
__metadata('design:type', Object) | ||
], SortablejsDirective.prototype, "_items", void 0); | ||
__decorate([ | ||
core_1.Input('sortablejsOptions'), | ||
__metadata('design:type', Object) | ||
], SortablejsDirective.prototype, "_options", void 0); | ||
__decorate([ | ||
core_1.Input(), | ||
__metadata('design:type', Boolean) | ||
], SortablejsDirective.prototype, "runInsideAngular", void 0); | ||
SortablejsDirective = __decorate([ | ||
core_1.Directive({ | ||
selector: '[sortablejs]' | ||
}), | ||
__metadata('design:paramtypes', [core_1.ElementRef, core_1.NgZone]) | ||
], SortablejsDirective); | ||
return SortablejsDirective; | ||
}()); | ||
__decorate([ | ||
core_1.Input('sortablejs'), | ||
__metadata("design:type", Object) | ||
], SortablejsDirective.prototype, "_items", void 0); | ||
__decorate([ | ||
core_1.Input('sortablejsOptions'), | ||
__metadata("design:type", Object) | ||
], SortablejsDirective.prototype, "_options", void 0); | ||
__decorate([ | ||
core_1.Input(), | ||
__metadata("design:type", Boolean) | ||
], SortablejsDirective.prototype, "runInsideAngular", void 0); | ||
SortablejsDirective = __decorate([ | ||
core_1.Directive({ | ||
selector: '[sortablejs]' | ||
}), | ||
__metadata("design:paramtypes", [core_1.ElementRef, core_1.NgZone]) | ||
], SortablejsDirective); | ||
exports.SortablejsDirective = SortablejsDirective; | ||
//# sourceMappingURL=sortable.directive.js.map |
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
22973
331