Skip to content

Commit

Permalink
move scroll to overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewseguin committed Dec 14, 2016
1 parent 7cd9329 commit 334aad7
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 38 deletions.
18 changes: 6 additions & 12 deletions src/lib/core/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -101,33 +98,30 @@ export {coerceNumberProperty} from './coercion/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],
};
}
}
5 changes: 3 additions & 2 deletions src/lib/core/overlay/overlay-directives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions src/lib/core/overlay/overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -93,4 +94,5 @@ export const OVERLAY_PROVIDERS = [
OverlayPositionBuilder,
Overlay,
OverlayContainer,
ScrollDispatcher,
];
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
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;
let fixture: ComponentFixture<ScrollingComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [ScrollModule.forRoot(), ScrollTestModule],
imports: [OverlayModule.forRoot(), ScrollTestModule],
});

TestBed.compileComponents();
Expand Down Expand Up @@ -69,7 +70,7 @@ class ScrollingComponent {

const TEST_COMPONENTS = [ScrollingComponent];
@NgModule({
imports: [ScrollModule],
imports: [OverlayModule],
providers: [ScrollDispatcher],
exports: TEST_COMPONENTS,
declarations: TEST_COMPONENTS,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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]
};
}
}
3 changes: 1 addition & 2 deletions src/lib/sidenav/sidenav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
5 changes: 2 additions & 3 deletions src/lib/tooltip/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -365,7 +364,7 @@ export class TooltipComponent {


@NgModule({
imports: [OverlayModule, DefaultStyleCompatibilityModeModule, ScrollModule],
imports: [OverlayModule, DefaultStyleCompatibilityModeModule],
exports: [MdTooltip, TooltipComponent, DefaultStyleCompatibilityModeModule],
declarations: [MdTooltip, TooltipComponent],
entryComponents: [TooltipComponent],
Expand Down

0 comments on commit 334aad7

Please sign in to comment.