Skip to content

Commit 2568018

Browse files
committed
fix(): Added AOT support
1 parent 681301f commit 2568018

7 files changed

+33
-23
lines changed

.github/CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ If you're changing the structure of the repository please create an issue first
33

44
## Submitting bug reports
55

6-
Make sure you are on latest changes and that you ran this command `npm run clean:install` after updating your local repository. If you can, please provide more infomation about your environment such as browser, operating system, node version, and npm version
6+
Make sure you are on latest changes and that you ran this command `npm install` after updating your local repository. If you can, please provide more infomation about your environment such as browser, operating system, node version, and npm version

.github/ISSUE_TEMPLATE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
* **Please tell us about your environment:**
2727

28-
- Angular version: 2.0.0-rc.X
28+
- Angular version: 2.X.X
2929
- Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
3030

3131

index.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import { NgModule, ModuleWithProviders } from "@angular/core";
66

77
import {DragDropConfig} from './src/dnd.config';
8-
import {DragDropService, DragDropSortableService} from './src/dnd.service';
8+
import {DragDropService, DragDropSortableService, dragDropServiceFactory, dragDropSortableServiceFactory} from './src/dnd.service';
99
import {DraggableComponent} from './src/draggable.component';
1010
import {DroppableComponent} from './src/droppable.component';
1111
import {SortableContainer, SortableComponent} from './src/sortable.component';
@@ -17,15 +17,21 @@ export * from './src/draggable.component';
1717
export * from './src/droppable.component';
1818
export * from './src/sortable.component';
1919

20+
export let providers = [
21+
{ provide: DragDropService, useFactory: dragDropServiceFactory },
22+
{ provide: DragDropSortableService, useFactory: dragDropSortableServiceFactory, deps: [DragDropConfig] }
23+
];
24+
2025
@NgModule({
2126
declarations: [DraggableComponent, DroppableComponent, SortableContainer, SortableComponent],
22-
exports : [DraggableComponent, DroppableComponent, SortableContainer, SortableComponent]
27+
exports : [DraggableComponent, DroppableComponent, SortableContainer, SortableComponent],
28+
2329
})
2430
export class DndModule {
2531
static forRoot(): ModuleWithProviders {
2632
return {
2733
ngModule: DndModule,
28-
providers: [DragDropConfig, DragDropService, DragDropSortableService]
34+
providers: providers
2935
};
3036
}
3137
}

package.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@
3535
"@angular/core": "^2.0.0"
3636
},
3737
"devDependencies": {
38-
"@angular/common": "2.1.2",
39-
"@angular/compiler": "2.1.2",
40-
"@angular/compiler-cli": "2.1.2",
41-
"@angular/core": "2.1.2",
42-
"@angular/platform-browser": "2.1.2",
43-
"@angular/platform-browser-dynamic": "2.1.2",
44-
"@angular/platform-server": "2.1.2",
38+
"@angular/common": "^2.1.2",
39+
"@angular/compiler": "^2.1.2",
40+
"@angular/compiler-cli": "^2.1.2",
41+
"@angular/core": "^2.1.2",
42+
"@angular/platform-browser": "^2.1.2",
43+
"@angular/platform-browser-dynamic": "^2.1.2",
44+
"@angular/platform-server": "^2.1.2",
4545
"@types/hammerjs": "2.0.33",
4646
"@types/jasmine": "2.5.37",
4747
"@types/node": "6.0.46",
@@ -63,15 +63,15 @@
6363
"karma-webpack": "^1.8.0",
6464
"loader-utils": "~0.2.16",
6565
"reflect-metadata": "0.1.8",
66-
"rxjs": "5.0.0-beta.12",
66+
"rxjs": "^5.0.1",
6767
"semantic-release": "4.3.5",
6868
"source-map-loader": "0.1.5",
6969
"ts-helpers": "1.1.2",
7070
"tslint": "3.15.1",
7171
"tslint-loader": "2.1.5",
7272
"typescript": "2.0.10",
7373
"webpack": "2.1.0-beta.25",
74-
"zone.js": "0.6.26"
74+
"zone.js": "^0.7.2"
7575
},
7676
"config": {
7777
"commitizen": {

src/dnd.config.ts

-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
// This project is licensed under the terms of the MIT license.
33
// https://github.com/akserg/ng2-dnd
44

5-
import {Injectable} from '@angular/core';
65
import {isString} from './dnd.utils';
76

8-
@Injectable()
97
export class DataTransferEffect {
108

119
static COPY = new DataTransferEffect('copy');
@@ -16,7 +14,6 @@ export class DataTransferEffect {
1614
constructor(public name: string) { }
1715
}
1816

19-
@Injectable()
2017
export class DragImage {
2118
constructor(
2219
public imageElement: any,
@@ -31,7 +28,6 @@ export class DragImage {
3128
}
3229
}
3330

34-
@Injectable()
3531
export class DragDropConfig {
3632
public onDragStartClass: string = "dnd-drag-start";
3733
public onDragEnterClass: string = "dnd-drag-enter";

src/dnd.service.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ import {Injectable, EventEmitter} from '@angular/core';
77
import {DragDropConfig} from './dnd.config';
88
import {isPresent} from './dnd.utils';
99

10-
export interface DragDropData {
10+
export class DragDropData {
1111
dragData: any;
1212
mouseEvent: MouseEvent;
1313
}
1414

15+
export function dragDropServiceFactory(): DragDropService {
16+
return new DragDropService();
17+
}
18+
1519
@Injectable()
1620
export class DragDropService {
1721
allowedDropZones: Array<string> = [];
@@ -20,6 +24,10 @@ export class DragDropService {
2024
isDragged: boolean;
2125
}
2226

27+
export function dragDropSortableServiceFactory(config: DragDropConfig): DragDropSortableService {
28+
return new DragDropSortableService(config);
29+
}
30+
2331
@Injectable()
2432
export class DragDropSortableService {
2533
index: number;

tsconfig.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
"./src/droppable.component.ts",
2525
"./src/sortable.component.ts",
2626

27-
"tests/dnd.component.factory.ts",
28-
"tests/dnd.sortable.spec.ts",
29-
"tests/dnd.with.draggable.data.spec.ts",
30-
"tests/dnd.without.draggable.data.spec.ts"
27+
"./tests/dnd.component.factory.ts",
28+
"./tests/dnd.sortable.spec.ts",
29+
"./tests/dnd.with.draggable.data.spec.ts",
30+
"./tests/dnd.without.draggable.data.spec.ts"
3131
],
3232
"exclude": [
3333
"node_modules",

0 commit comments

Comments
 (0)