angular-sortablejs
Advanced tools
Comparing version 2.1.0 to 2.2.0
import { SortablejsOptions } from './sortablejs-options'; | ||
export declare const GLOBALS: { | ||
options: SortablejsOptions; | ||
}; | ||
import { InjectionToken } from '@angular/core'; | ||
export declare const GLOBALS: InjectionToken<SortablejsOptions>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GLOBALS = { | ||
options: {} | ||
}; | ||
var core_1 = require("@angular/core"); | ||
exports.GLOBALS = new core_1.InjectionToken('Global config for sortablejs'); | ||
//# sourceMappingURL=globals.js.map |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"GLOBALS":{"options":{}}}},{"__symbolic":"module","version":1,"metadata":{"GLOBALS":{"options":{}}}}] | ||
[{"__symbolic":"module","version":3,"metadata":{"GLOBALS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken"},"arguments":["Global config for sortablejs"]}}},{"__symbolic":"module","version":1,"metadata":{"GLOBALS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken"},"arguments":["Global config for sortablejs"]}}}] |
@@ -5,2 +5,3 @@ import { ElementRef, OnInit, OnChanges, OnDestroy, NgZone, SimpleChanges, ChangeDetectorRef } from '@angular/core'; | ||
export declare class SortablejsDirective implements OnInit, OnChanges, OnDestroy { | ||
private globalConfig; | ||
private sortablejsService; | ||
@@ -14,3 +15,3 @@ private element; | ||
runInsideAngular: boolean; | ||
constructor(sortablejsService: SortablejsService, element: ElementRef, zone: NgZone, cdr: ChangeDetectorRef); | ||
constructor(globalConfig: SortablejsOptions, sortablejsService: SortablejsService, element: ElementRef, zone: NgZone, cdr: ChangeDetectorRef); | ||
ngOnInit(): void; | ||
@@ -17,0 +18,0 @@ ngOnChanges(changes: SimpleChanges): void; |
@@ -8,3 +8,4 @@ "use strict"; | ||
var SortablejsDirective = (function () { | ||
function SortablejsDirective(sortablejsService, element, zone, cdr) { | ||
function SortablejsDirective(globalConfig, sortablejsService, element, zone, cdr) { | ||
this.globalConfig = globalConfig; | ||
this.sortablejsService = sortablejsService; | ||
@@ -47,3 +48,3 @@ this.element = element; | ||
get: function () { | ||
return Object.assign({}, globals_1.GLOBALS.options, this.inputOptions, this.overridenOptions); | ||
return Object.assign({}, this.globalConfig, this.inputOptions, this.overridenOptions); | ||
}, | ||
@@ -131,2 +132,3 @@ enumerable: true, | ||
SortablejsDirective.ctorParameters = function () { return [ | ||
{ type: undefined, decorators: [{ type: core_1.Inject, args: [globals_1.GLOBALS,] },] }, | ||
{ type: sortablejs_service_1.SortablejsService, }, | ||
@@ -133,0 +135,0 @@ { type: core_1.ElementRef, }, |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"SortablejsDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[sortablejs]"}]}],"members":{"items":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["sortablejs"]}]}],"inputOptions":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["sortablejsOptions"]}]}],"runInsideAngular":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"./sortablejs.service","name":"SortablejsService"},{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"@angular/core","name":"NgZone"},{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef"}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"proxyEvent":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"SortablejsDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[sortablejs]"}]}],"members":{"items":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["sortablejs"]}]}],"inputOptions":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["sortablejsOptions"]}]}],"runInsideAngular":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"./sortablejs.service","name":"SortablejsService"},{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"@angular/core","name":"NgZone"},{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef"}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"proxyEvent":[{"__symbolic":"method"}]}}}}] | ||
[{"__symbolic":"module","version":3,"metadata":{"SortablejsDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[sortablejs]"}]}],"members":{"items":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["sortablejs"]}]}],"inputOptions":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["sortablejsOptions"]}]}],"runInsideAngular":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"./globals","name":"GLOBALS"}]}],null,null,null,null],"parameters":[{"__symbolic":"reference","module":"./sortablejs-options","name":"SortablejsOptions"},{"__symbolic":"reference","module":"./sortablejs.service","name":"SortablejsService"},{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"@angular/core","name":"NgZone"},{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef"}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"proxyEvent":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"SortablejsDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[sortablejs]"}]}],"members":{"items":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["sortablejs"]}]}],"inputOptions":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"},"arguments":["sortablejsOptions"]}]}],"runInsideAngular":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject"},"arguments":[{"__symbolic":"reference","module":"./globals","name":"GLOBALS"}]}],null,null,null,null],"parameters":[{"__symbolic":"reference","module":"./sortablejs-options","name":"SortablejsOptions"},{"__symbolic":"reference","module":"./sortablejs.service","name":"SortablejsService"},{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"@angular/core","name":"NgZone"},{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef"}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"proxyEvent":[{"__symbolic":"method"}]}}}}] |
@@ -11,7 +11,7 @@ "use strict"; | ||
SortablejsModule.forRoot = function (globalOptions) { | ||
globals_1.GLOBALS.options = globalOptions; | ||
return { | ||
ngModule: SortablejsModule, | ||
providers: [ | ||
sortablejs_service_1.SortablejsService | ||
sortablejs_service_1.SortablejsService, | ||
{ provide: globals_1.GLOBALS, useValue: globalOptions } | ||
] | ||
@@ -18,0 +18,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":3,"metadata":{"SortablejsModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"declarations":[{"__symbolic":"reference","module":"./sortablejs.directive","name":"SortablejsDirective"}],"exports":[{"__symbolic":"reference","module":"./sortablejs.directive","name":"SortablejsDirective"}],"providers":[{"__symbolic":"reference","module":"./sortablejs.service","name":"SortablejsService"}]}]}]}}},{"__symbolic":"module","version":1,"metadata":{"SortablejsModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"declarations":[{"__symbolic":"reference","module":"./sortablejs.directive","name":"SortablejsDirective"}],"exports":[{"__symbolic":"reference","module":"./sortablejs.directive","name":"SortablejsDirective"}],"providers":[{"__symbolic":"reference","module":"./sortablejs.service","name":"SortablejsService"}]}]}]}}}] | ||
[{"__symbolic":"module","version":3,"metadata":{"SortablejsModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"declarations":[{"__symbolic":"reference","module":"./sortablejs.directive","name":"SortablejsDirective"}],"exports":[{"__symbolic":"reference","module":"./sortablejs.directive","name":"SortablejsDirective"}],"providers":[{"__symbolic":"reference","module":"./sortablejs.service","name":"SortablejsService"}]}]}],"statics":{"forRoot":{"__symbolic":"function","parameters":["globalOptions"],"value":{"ngModule":{"__symbolic":"reference","name":"SortablejsModule"},"providers":[{"__symbolic":"reference","module":"./sortablejs.service","name":"SortablejsService"},{"provide":{"__symbolic":"reference","module":"./globals","name":"GLOBALS"},"useValue":{"__symbolic":"reference","name":"globalOptions"}}]}}}}}},{"__symbolic":"module","version":1,"metadata":{"SortablejsModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"declarations":[{"__symbolic":"reference","module":"./sortablejs.directive","name":"SortablejsDirective"}],"exports":[{"__symbolic":"reference","module":"./sortablejs.directive","name":"SortablejsDirective"}],"providers":[{"__symbolic":"reference","module":"./sortablejs.service","name":"SortablejsService"}]}]}],"statics":{"forRoot":{"__symbolic":"function","parameters":["globalOptions"],"value":{"ngModule":{"__symbolic":"reference","name":"SortablejsModule"},"providers":[{"__symbolic":"reference","module":"./sortablejs.service","name":"SortablejsService"},{"provide":{"__symbolic":"reference","module":"./globals","name":"GLOBALS"},"useValue":{"__symbolic":"reference","name":"globalOptions"}}]}}}}}}] |
{ | ||
"name": "angular-sortablejs", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "SortableJS for Angular", | ||
@@ -51,4 +51,4 @@ "main": "./dist/index.js", | ||
"peerDependencies": { | ||
"sortablejs": "^1.5.1", | ||
"@angular/core": "^4.0.0" | ||
"sortablejs": ">=1.5.1", | ||
"@angular/core": ">=4.0.0" | ||
}, | ||
@@ -55,0 +55,0 @@ "files": [ |
@@ -19,35 +19,4 @@ # angular-sortablejs | ||
### Webpack configuration | ||
You are configured now. If you use Webpack or Angular CLI go to the usage. If you have SystemJS, that's sad, but you can go to the end of the document to find configuration steps there. | ||
There is nothing to configure additionally. Enjoy! | ||
### SystemJS configuration | ||
Adapt your `systemjs.config.js` (or another place where you configure SystemJS) file with the following: | ||
```javascript | ||
// ... | ||
var map = { | ||
// ... | ||
'angular-sortablejs': 'node_modules/angular-sortablejs/dist/', | ||
'sortablejs/Sortable.min': 'node_modules/sortablejs/Sortable.min.js', | ||
// ... | ||
}; | ||
// ... | ||
var packages = { | ||
// ... | ||
'angular-sortablejs': { main: 'index.js', defaultExtension: 'js' }, | ||
// ... | ||
}; | ||
// ... | ||
var config = { | ||
map: map, | ||
packages: packages | ||
}; | ||
System.config(config); | ||
``` | ||
This is important to let SystemJS know everything it needs about the dependencies it needs to load. | ||
## Usage | ||
@@ -230,1 +199,32 @@ | ||
Original events `onAdd`, `onRemove`, `onUpdate` are intercepted by the library in order to reflect the sortable changes into the data. If you will add your own event handlers (inside of the options object) they will be called right after the data binding is done. If you don't pass the data, e.g. `<div sortablejs>` the data binding is skipped and only your event handlers will be fired. | ||
## SystemJS configuration | ||
**IMPORTANT:** Follow this only if you have SystemJS. If you have no errors without this step - most likely you don't need it! | ||
Adapt your `systemjs.config.js` (or another place where you configure SystemJS) file with the following: | ||
```javascript | ||
// ... | ||
var map = { | ||
// ... | ||
'angular-sortablejs': 'node_modules/angular-sortablejs/dist/', | ||
'sortablejs/Sortable.min': 'node_modules/sortablejs/Sortable.min.js', | ||
// ... | ||
}; | ||
// ... | ||
var packages = { | ||
// ... | ||
'angular-sortablejs': { main: 'index.js', defaultExtension: 'js' }, | ||
// ... | ||
}; | ||
// ... | ||
var config = { | ||
map: map, | ||
packages: packages | ||
}; | ||
System.config(config); | ||
``` | ||
This is important to let SystemJS know everything it needs about the dependencies it needs to load. |
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
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
32520
265