diff --git a/src/lib/core/core.ts b/src/lib/core/core.ts index 68034b044e62..e5cd89b74eec 100644 --- a/src/lib/core/core.ts +++ b/src/lib/core/core.ts @@ -6,8 +6,6 @@ import {PortalModule} from './portal/portal-directives'; import {OverlayModule} from './overlay/overlay-directives'; import {A11yModule, A11Y_PROVIDERS} from './a11y/index'; import {OVERLAY_PROVIDERS} from './overlay/overlay'; -import {ScrollDispatcher} from './scroll/scroll-dispatcher'; -import {ScrollModule} from './scroll/scrollable'; // RTL @@ -47,8 +45,7 @@ export { } from './overlay/overlay-directives'; export * from './overlay/position/connected-position-strategy'; export * from './overlay/position/connected-position'; -export * from './scroll/scrollable'; -export * from './scroll/scroll-dispatcher'; +export {ScrollDispatcher} from './overlay/scroll/scroll-dispatcher'; // Gestures export {MdGestureConfig} from './gestures/MdGestureConfig'; @@ -101,33 +98,30 @@ export {coerceNumberProperty} from './coersion/number-property'; export {DefaultStyleCompatibilityModeModule} from './compatibility/default-mode'; export {NoConflictStyleCompatibilityMode} from './compatibility/no-conflict-mode'; -// ScrollDispatcher -export {ScrollDispatcher} from './scroll/scroll-dispatcher'; -export {Scrollable} from './scroll/scrollable'; @NgModule({ - imports: [MdLineModule, + imports: [ + MdLineModule, RtlModule, MdRippleModule, PortalModule, OverlayModule, A11yModule, - ScrollModule ], - exports: [MdLineModule, + exports: [ + MdLineModule, RtlModule, MdRippleModule, PortalModule, OverlayModule, A11yModule, - ScrollModule ], }) export class MdCoreModule { static forRoot(): ModuleWithProviders { return { ngModule: MdCoreModule, - providers: [A11Y_PROVIDERS, OVERLAY_PROVIDERS, ScrollDispatcher], + providers: [A11Y_PROVIDERS, OVERLAY_PROVIDERS], }; } } diff --git a/src/lib/core/overlay/overlay-directives.ts b/src/lib/core/overlay/overlay-directives.ts index 10611389e3a6..b050d21e189d 100644 --- a/src/lib/core/overlay/overlay-directives.ts +++ b/src/lib/core/overlay/overlay-directives.ts @@ -23,6 +23,7 @@ import {PortalModule} from '../portal/portal-directives'; import {ConnectedPositionStrategy} from './position/connected-position-strategy'; import {Subscription} from 'rxjs/Subscription'; import {Dir, LayoutDirection} from '../rtl/dir'; +import {Scrollable} from './scroll/scrollable'; /** Default set of positions for the overlay. Follows the behavior of a dropdown. */ let defaultPositionList = [ @@ -285,8 +286,8 @@ export class ConnectedOverlayDirective implements OnDestroy { @NgModule({ imports: [PortalModule], - exports: [ConnectedOverlayDirective, OverlayOrigin], - declarations: [ConnectedOverlayDirective, OverlayOrigin], + exports: [ConnectedOverlayDirective, OverlayOrigin, Scrollable], + declarations: [ConnectedOverlayDirective, OverlayOrigin, Scrollable], }) export class OverlayModule { static forRoot(): ModuleWithProviders { diff --git a/src/lib/core/overlay/overlay.ts b/src/lib/core/overlay/overlay.ts index 22a4d43e546e..8e0243def35c 100644 --- a/src/lib/core/overlay/overlay.ts +++ b/src/lib/core/overlay/overlay.ts @@ -11,6 +11,7 @@ import {OverlayRef} from './overlay-ref'; import {OverlayPositionBuilder} from './position/overlay-position-builder'; import {ViewportRuler} from './position/viewport-ruler'; import {OverlayContainer} from './overlay-container'; +import {ScrollDispatcher} from './scroll/scroll-dispatcher'; /** Next overlay unique ID. */ let nextUniqueId = 0; @@ -93,4 +94,5 @@ export const OVERLAY_PROVIDERS = [ OverlayPositionBuilder, Overlay, OverlayContainer, + ScrollDispatcher, ]; diff --git a/src/lib/core/scroll/scroll-dispatcher.spec.ts b/src/lib/core/overlay/scroll/scroll-dispatcher.spec.ts similarity index 93% rename from src/lib/core/scroll/scroll-dispatcher.spec.ts rename to src/lib/core/overlay/scroll/scroll-dispatcher.spec.ts index 2d476e22deaa..8975198ab9ce 100644 --- a/src/lib/core/scroll/scroll-dispatcher.spec.ts +++ b/src/lib/core/overlay/scroll/scroll-dispatcher.spec.ts @@ -1,7 +1,8 @@ import {inject, TestBed, async, ComponentFixture} from '@angular/core/testing'; import {NgModule, Component, ViewChild, ElementRef} from '@angular/core'; import {ScrollDispatcher} from './scroll-dispatcher'; -import {ScrollModule, Scrollable} from './scrollable'; +import {OverlayModule} from '../overlay-directives'; +import {Scrollable} from './scrollable'; describe('Scroll Dispatcher', () => { let scroll: ScrollDispatcher; @@ -9,7 +10,7 @@ describe('Scroll Dispatcher', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - imports: [ScrollModule.forRoot(), ScrollTestModule], + imports: [OverlayModule.forRoot(), ScrollTestModule], }); TestBed.compileComponents(); @@ -69,7 +70,7 @@ class ScrollingComponent { const TEST_COMPONENTS = [ScrollingComponent]; @NgModule({ - imports: [ScrollModule], + imports: [OverlayModule], providers: [ScrollDispatcher], exports: TEST_COMPONENTS, declarations: TEST_COMPONENTS, diff --git a/src/lib/core/scroll/scroll-dispatcher.ts b/src/lib/core/overlay/scroll/scroll-dispatcher.ts similarity index 100% rename from src/lib/core/scroll/scroll-dispatcher.ts rename to src/lib/core/overlay/scroll/scroll-dispatcher.ts diff --git a/src/lib/core/scroll/scrollable.ts b/src/lib/core/overlay/scroll/scrollable.ts similarity index 74% rename from src/lib/core/scroll/scrollable.ts rename to src/lib/core/overlay/scroll/scrollable.ts index 6d26ecb47c07..5c66681f3b45 100644 --- a/src/lib/core/scroll/scrollable.ts +++ b/src/lib/core/overlay/scroll/scrollable.ts @@ -1,6 +1,5 @@ import { - Directive, ElementRef, OnInit, OnDestroy, ModuleWithProviders, - NgModule + Directive, ElementRef, OnInit, OnDestroy } from '@angular/core'; import {Observable} from 'rxjs/Observable'; import {ScrollDispatcher} from './scroll-dispatcher'; @@ -31,17 +30,3 @@ export class Scrollable implements OnInit, OnDestroy { return Observable.fromEvent(this._elementRef.nativeElement, 'scroll'); } } - - -@NgModule({ - exports: [Scrollable], - declarations: [Scrollable], -}) -export class ScrollModule { - static forRoot(): ModuleWithProviders { - return { - ngModule: ScrollModule, - providers: [ScrollDispatcher] - }; - } -} diff --git a/src/lib/sidenav/sidenav.ts b/src/lib/sidenav/sidenav.ts index ad479e18473e..8a644ad1e037 100644 --- a/src/lib/sidenav/sidenav.ts +++ b/src/lib/sidenav/sidenav.ts @@ -21,10 +21,9 @@ import {A11yModule} from '../core/a11y/index'; import {FocusTrap} from '../core/a11y/focus-trap'; import {ESCAPE} from '../core/keyboard/keycodes'; import {OverlayModule} from '../core/overlay/overlay-directives'; -import {ScrollModule} from '../core/scroll/scrollable'; import {InteractivityChecker} from '../core/a11y/interactivity-checker'; import {MdLiveAnnouncer} from '../core/a11y/live-announcer'; -import {ScrollDispatcher} from '../core/scroll/scroll-dispatcher'; +import {ScrollDispatcher} from '../core/overlay/scroll/scroll-dispatcher'; /** Exception thrown when two MdSidenav are matching the same side. */ diff --git a/src/lib/tooltip/tooltip.ts b/src/lib/tooltip/tooltip.ts index 776b92ccd880..9a6c2b789041 100644 --- a/src/lib/tooltip/tooltip.ts +++ b/src/lib/tooltip/tooltip.ts @@ -29,8 +29,7 @@ import {MdTooltipInvalidPositionError} from './tooltip-errors'; import {Observable} from 'rxjs/Observable'; import {Subject} from 'rxjs/Subject'; import {Dir} from '../core/rtl/dir'; -import {ScrollDispatcher} from '../core/scroll/scroll-dispatcher'; -import {ScrollModule} from '../core/scroll/scrollable'; +import {ScrollDispatcher} from '../core/overlay/scroll/scroll-dispatcher'; import {OverlayPositionBuilder} from '../core/overlay/position/overlay-position-builder'; import {ViewportRuler} from '../core/overlay/position/viewport-ruler'; @@ -365,7 +364,7 @@ export class TooltipComponent { @NgModule({ - imports: [OverlayModule, DefaultStyleCompatibilityModeModule, ScrollModule], + imports: [OverlayModule, DefaultStyleCompatibilityModeModule], exports: [MdTooltip, TooltipComponent, DefaultStyleCompatibilityModeModule], declarations: [MdTooltip, TooltipComponent], entryComponents: [TooltipComponent],