Skip to content

Commit

Permalink
fix(): Added AOT support
Browse files Browse the repository at this point in the history
  • Loading branch information
akserg committed Dec 22, 2016
1 parent 681301f commit 2568018
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ If you're changing the structure of the repository please create an issue first

## Submitting bug reports

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
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
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

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

- Angular version: 2.0.0-rc.X
- Angular version: 2.X.X
- 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 ]


Expand Down
12 changes: 9 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { NgModule, ModuleWithProviders } from "@angular/core";

import {DragDropConfig} from './src/dnd.config';
import {DragDropService, DragDropSortableService} from './src/dnd.service';
import {DragDropService, DragDropSortableService, dragDropServiceFactory, dragDropSortableServiceFactory} from './src/dnd.service';
import {DraggableComponent} from './src/draggable.component';
import {DroppableComponent} from './src/droppable.component';
import {SortableContainer, SortableComponent} from './src/sortable.component';
Expand All @@ -17,15 +17,21 @@ export * from './src/draggable.component';
export * from './src/droppable.component';
export * from './src/sortable.component';

export let providers = [
{ provide: DragDropService, useFactory: dragDropServiceFactory },
{ provide: DragDropSortableService, useFactory: dragDropSortableServiceFactory, deps: [DragDropConfig] }
];

@NgModule({
declarations: [DraggableComponent, DroppableComponent, SortableContainer, SortableComponent],
exports : [DraggableComponent, DroppableComponent, SortableContainer, SortableComponent]
exports : [DraggableComponent, DroppableComponent, SortableContainer, SortableComponent],

})
export class DndModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: DndModule,
providers: [DragDropConfig, DragDropService, DragDropSortableService]
providers: providers
};
}
}
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@
"@angular/core": "^2.0.0"
},
"devDependencies": {
"@angular/common": "2.1.2",
"@angular/compiler": "2.1.2",
"@angular/compiler-cli": "2.1.2",
"@angular/core": "2.1.2",
"@angular/platform-browser": "2.1.2",
"@angular/platform-browser-dynamic": "2.1.2",
"@angular/platform-server": "2.1.2",
"@angular/common": "^2.1.2",
"@angular/compiler": "^2.1.2",
"@angular/compiler-cli": "^2.1.2",
"@angular/core": "^2.1.2",
"@angular/platform-browser": "^2.1.2",
"@angular/platform-browser-dynamic": "^2.1.2",
"@angular/platform-server": "^2.1.2",
"@types/hammerjs": "2.0.33",
"@types/jasmine": "2.5.37",
"@types/node": "6.0.46",
Expand All @@ -63,15 +63,15 @@
"karma-webpack": "^1.8.0",
"loader-utils": "~0.2.16",
"reflect-metadata": "0.1.8",
"rxjs": "5.0.0-beta.12",
"rxjs": "^5.0.1",
"semantic-release": "4.3.5",
"source-map-loader": "0.1.5",
"ts-helpers": "1.1.2",
"tslint": "3.15.1",
"tslint-loader": "2.1.5",
"typescript": "2.0.10",
"webpack": "2.1.0-beta.25",
"zone.js": "0.6.26"
"zone.js": "^0.7.2"
},
"config": {
"commitizen": {
Expand Down
4 changes: 0 additions & 4 deletions src/dnd.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
// This project is licensed under the terms of the MIT license.
// https://github.com/akserg/ng2-dnd

import {Injectable} from '@angular/core';
import {isString} from './dnd.utils';

@Injectable()
export class DataTransferEffect {

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

@Injectable()
export class DragImage {
constructor(
public imageElement: any,
Expand All @@ -31,7 +28,6 @@ export class DragImage {
}
}

@Injectable()
export class DragDropConfig {
public onDragStartClass: string = "dnd-drag-start";
public onDragEnterClass: string = "dnd-drag-enter";
Expand Down
10 changes: 9 additions & 1 deletion src/dnd.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ import {Injectable, EventEmitter} from '@angular/core';
import {DragDropConfig} from './dnd.config';
import {isPresent} from './dnd.utils';

export interface DragDropData {
export class DragDropData {
dragData: any;
mouseEvent: MouseEvent;
}

export function dragDropServiceFactory(): DragDropService {
return new DragDropService();
}

@Injectable()
export class DragDropService {
allowedDropZones: Array<string> = [];
Expand All @@ -20,6 +24,10 @@ export class DragDropService {
isDragged: boolean;
}

export function dragDropSortableServiceFactory(config: DragDropConfig): DragDropSortableService {
return new DragDropSortableService(config);
}

@Injectable()
export class DragDropSortableService {
index: number;
Expand Down
8 changes: 4 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
"./src/droppable.component.ts",
"./src/sortable.component.ts",

"tests/dnd.component.factory.ts",
"tests/dnd.sortable.spec.ts",
"tests/dnd.with.draggable.data.spec.ts",
"tests/dnd.without.draggable.data.spec.ts"
"./tests/dnd.component.factory.ts",
"./tests/dnd.sortable.spec.ts",
"./tests/dnd.with.draggable.data.spec.ts",
"./tests/dnd.without.draggable.data.spec.ts"
],
"exclude": [
"node_modules",
Expand Down

0 comments on commit 2568018

Please sign in to comment.