@@ -11,7 +11,7 @@ import {
1111 DragPreviewDirective
1212} from './dnd.directive' ;
1313
14- import { DRAG_DROP_BACKEND , DRAG_DROP_MANAGER } from './tokens' ;
14+ import { DRAG_DROP_BACKEND , DRAG_DROP_BACKEND_OPTIONS , DRAG_DROP_BACKEND_DEBUG_MODE , DRAG_DROP_MANAGER } from './tokens' ;
1515
1616import {
1717 createDragDropManager ,
@@ -41,11 +41,13 @@ export function unpackBackendForEs5Users(backendOrModule: any) {
4141export function managerFactory (
4242 backendFactory : BackendFactory ,
4343 zone : NgZone ,
44- context = { window : window }
45- ) : DragDropManager < any > {
44+ context = { window : window } ,
45+ backendOptions ?: any ,
46+ debugMode ?: boolean ,
47+ ) : DragDropManager {
4648 backendFactory = unpackBackendForEs5Users ( backendFactory ) ;
4749 return zone . runOutsideAngular ( ( ) =>
48- createDragDropManager ( backendFactory , context )
50+ createDragDropManager ( backendFactory , context , backendOptions , debugMode )
4951 ) ;
5052}
5153
@@ -69,6 +71,8 @@ export function managerFactory(
6971export interface BackendInput {
7072 /** A plain backend, for example the HTML5Backend. */
7173 backend : BackendFactory ;
74+ options ?: any ;
75+ debug ?: boolean ,
7276}
7377
7478/**
@@ -97,14 +101,15 @@ export interface BackendInput {
97101export interface BackendFactoryInput {
98102 /** See above. */
99103 backendFactory : ( ) => BackendFactory ;
104+ debug ?: boolean ;
100105}
101106
102107/** @ignore */
103108const EXPORTS = [
104109 DragSourceDirective ,
105110 DropTargetDirective ,
106111 DragPreviewDirective ,
107- ]
112+ ] ;
108113
109114@NgModule ( {
110115 declarations : EXPORTS ,
@@ -124,10 +129,25 @@ export class SkyhookDndModule {
124129 useFactory : ( backendOrBackendFactory as BackendFactoryInput )
125130 . backendFactory
126131 } ,
132+ {
133+ provide : DRAG_DROP_BACKEND_OPTIONS ,
134+ // whichever one they have provided, the other will be undefined
135+ useValue : ( backendOrBackendFactory as BackendInput ) . options ,
136+ } ,
137+ {
138+ provide : DRAG_DROP_BACKEND_DEBUG_MODE ,
139+ // whichever one they have provided, the other will be undefined
140+ useValue : backendOrBackendFactory . debug ,
141+ } ,
127142 {
128143 provide : DRAG_DROP_MANAGER ,
129144 useFactory : managerFactory ,
130- deps : [ DRAG_DROP_BACKEND , NgZone ]
145+ deps : [
146+ DRAG_DROP_BACKEND ,
147+ NgZone ,
148+ DRAG_DROP_BACKEND_OPTIONS ,
149+ DRAG_DROP_BACKEND_DEBUG_MODE
150+ ]
131151 } ,
132152 SkyhookDndService
133153 ]
0 commit comments