Skip to content

Commit

Permalink
feat(cdk): move cdkScrollable, ScrollDispatcher, and ViewportRuler ou…
Browse files Browse the repository at this point in the history
…t of overlay (#6547)
  • Loading branch information
jelbourn authored and kara committed Aug 23, 2017
1 parent c90ca55 commit 0f6a2ec
Show file tree
Hide file tree
Showing 37 changed files with 95 additions and 65 deletions.
6 changes: 3 additions & 3 deletions src/cdk/overlay/position/connected-position-strategy.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {ElementRef} from '@angular/core';
import {TestBed, inject} from '@angular/core/testing';
import {ConnectedPositionStrategy} from './connected-position-strategy';
import {ViewportRuler, VIEWPORT_RULER_PROVIDER} from './viewport-ruler';
import {ViewportRuler, VIEWPORT_RULER_PROVIDER} from '@angular/cdk/scrolling';
import {OverlayPositionBuilder} from './overlay-position-builder';
import {ConnectedOverlayPositionChange} from './connected-position';
import {Scrollable} from '../scroll/scrollable';
import {Scrollable} from '@angular/cdk/scrolling';
import {Subscription} from 'rxjs/Subscription';
import {ScrollDispatchModule} from '../scroll/index';
import {ScrollDispatchModule} from '@angular/cdk/scrolling';
import {OverlayRef} from '../overlay-ref';


Expand Down
4 changes: 2 additions & 2 deletions src/cdk/overlay/position/connected-position-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import {PositionStrategy} from './position-strategy';
import {ElementRef} from '@angular/core';
import {ViewportRuler} from './viewport-ruler';
import {ViewportRuler} from '@angular/cdk/scrolling';
import {
ConnectionPositionPair,
OriginConnectionPosition,
Expand All @@ -18,7 +18,7 @@ import {
} from './connected-position';
import {Subject} from 'rxjs/Subject';
import {Observable} from 'rxjs/Observable';
import {Scrollable} from '../scroll/scrollable';
import {Scrollable} from '@angular/cdk/scrolling';
import {isElementScrolledOutsideView, isElementClippedByScrolling} from './scroll-clip';
import {OverlayRef} from '../overlay-ref';

Expand Down
2 changes: 1 addition & 1 deletion src/cdk/overlay/position/overlay-position-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import {ElementRef, Injectable} from '@angular/core';
import {ViewportRuler} from './viewport-ruler';
import {ViewportRuler} from '@angular/cdk/scrolling';
import {ConnectedPositionStrategy} from './connected-position-strategy';
import {GlobalPositionStrategy} from './global-position-strategy';
import {OverlayConnectionPosition, OriginConnectionPosition} from './connected-position';
Expand Down
12 changes: 6 additions & 6 deletions src/cdk/overlay/public_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
import {NgModule, Provider} from '@angular/core';
import {PortalModule} from '@angular/cdk/portal';
import {Overlay} from './overlay';
import {ScrollDispatchModule} from './scroll/index';
import {ScrollDispatchModule, VIEWPORT_RULER_PROVIDER} from '@angular/cdk/scrolling';
import {
ConnectedOverlayDirective,
OverlayOrigin,
MD_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER,
OverlayOrigin,
} from './overlay-directives';
import {OverlayPositionBuilder} from './position/overlay-position-builder';
import {VIEWPORT_RULER_PROVIDER} from './position/viewport-ruler';
import {OVERLAY_CONTAINER_PROVIDER} from './overlay-container';
import {ScrollStrategyOptions} from './scroll/scroll-strategy-options';


export const OVERLAY_PROVIDERS: Provider[] = [
Expand All @@ -31,7 +31,7 @@ export const OVERLAY_PROVIDERS: Provider[] = [
imports: [PortalModule, ScrollDispatchModule],
exports: [ConnectedOverlayDirective, OverlayOrigin, ScrollDispatchModule],
declarations: [ConnectedOverlayDirective, OverlayOrigin],
providers: [OVERLAY_PROVIDERS],
providers: [OVERLAY_PROVIDERS, ScrollStrategyOptions],
})
export class OverlayModule {}

Expand All @@ -42,7 +42,7 @@ export {FullscreenOverlayContainer} from './fullscreen-overlay-container';
export {OverlayRef} from './overlay-ref';
export {OverlayState} from './overlay-state';
export {ConnectedOverlayDirective, OverlayOrigin} from './overlay-directives';
export {ViewportRuler} from './position/viewport-ruler';
export {ViewportRuler} from '@angular/cdk/scrolling';
export {ComponentType} from '@angular/cdk/portal';

export * from './position/connected-position';
Expand All @@ -52,4 +52,4 @@ export * from './scroll/index';
export {PositionStrategy} from './position/position-strategy';
export {GlobalPositionStrategy} from './position/global-position-strategy';
export {ConnectedPositionStrategy} from './position/connected-position-strategy';
export {VIEWPORT_RULER_PROVIDER} from './position/viewport-ruler';
export {VIEWPORT_RULER_PROVIDER} from '@angular/cdk/scrolling';
14 changes: 4 additions & 10 deletions src/cdk/overlay/scroll/block-scroll-strategy.spec.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import {NgModule, Component} from '@angular/core';
import {inject, TestBed, async} from '@angular/core/testing';
import {Component, NgModule} from '@angular/core';
import {async, inject, TestBed} from '@angular/core/testing';
import {ComponentPortal, PortalModule} from '@angular/cdk/portal';
import {Platform} from '@angular/cdk/platform';
import {
OverlayModule,
ViewportRuler,
OverlayState,
Overlay,
OverlayRef,
OverlayContainer,
} from '../index';
import {ViewportRuler} from '@angular/cdk/scrolling';
import {Overlay, OverlayContainer, OverlayModule, OverlayRef, OverlayState} from '../index';


describe('BlockScrollStrategy', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/cdk/overlay/scroll/block-scroll-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import {ScrollStrategy} from './scroll-strategy';
import {ViewportRuler} from '../position/viewport-ruler';
import {ViewportRuler} from '@angular/cdk/scrolling';

/**
* Strategy that will prevent the user from scrolling while the overlay is visible.
Expand Down
2 changes: 1 addition & 1 deletion src/cdk/overlay/scroll/close-scroll-strategy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import {inject, TestBed, async} from '@angular/core/testing';
import {NgModule, Component} from '@angular/core';
import {Subject} from 'rxjs/Subject';
import {ComponentPortal, PortalModule} from '@angular/cdk/portal';
import {ScrollDispatcher} from '@angular/cdk/scrolling';
import {
Overlay,
OverlayState,
OverlayRef,
OverlayModule,
ScrollDispatcher,
OverlayContainer,
} from '../index';

Expand Down
2 changes: 1 addition & 1 deletion src/cdk/overlay/scroll/close-scroll-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import {ScrollStrategy, getMdScrollStrategyAlreadyAttachedError} from './scroll-strategy';
import {OverlayRef} from '../overlay-ref';
import {Subscription} from 'rxjs/Subscription';
import {ScrollDispatcher} from './scroll-dispatcher';
import {ScrollDispatcher} from '@angular/cdk/scrolling';


/**
Expand Down
17 changes: 1 addition & 16 deletions src/cdk/overlay/scroll/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import {NgModule} from '@angular/core';
import {PlatformModule} from '@angular/cdk/platform';
import {SCROLL_DISPATCHER_PROVIDER} from './scroll-dispatcher';
import {Scrollable} from './scrollable';
import {ScrollStrategyOptions} from './scroll-strategy-options';

export {Scrollable} from './scrollable';
export {ScrollDispatcher} from './scroll-dispatcher';
export {Scrollable, ScrollDispatcher} from '@angular/cdk/scrolling';

// Export pre-defined scroll strategies and interface to build custom ones.
export {ScrollStrategy} from './scroll-strategy';
Expand All @@ -22,11 +15,3 @@ export {RepositionScrollStrategy} from './reposition-scroll-strategy';
export {CloseScrollStrategy} from './close-scroll-strategy';
export {NoopScrollStrategy} from './noop-scroll-strategy';
export {BlockScrollStrategy} from './block-scroll-strategy';

@NgModule({
imports: [PlatformModule],
exports: [Scrollable],
declarations: [Scrollable],
providers: [SCROLL_DISPATCHER_PROVIDER, ScrollStrategyOptions],
})
export class ScrollDispatchModule { }
2 changes: 1 addition & 1 deletion src/cdk/overlay/scroll/reposition-scroll-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import {Subscription} from 'rxjs/Subscription';
import {ScrollStrategy, getMdScrollStrategyAlreadyAttachedError} from './scroll-strategy';
import {OverlayRef} from '../overlay-ref';
import {ScrollDispatcher} from './scroll-dispatcher';
import {ScrollDispatcher} from '@angular/cdk/scrolling';

/**
* Config options for the RepositionScrollStrategy.
Expand Down
4 changes: 2 additions & 2 deletions src/cdk/overlay/scroll/scroll-strategy-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {Injectable} from '@angular/core';
import {CloseScrollStrategy} from './close-scroll-strategy';
import {NoopScrollStrategy} from './noop-scroll-strategy';
import {BlockScrollStrategy} from './block-scroll-strategy';
import {ScrollDispatcher} from './scroll-dispatcher';
import {ViewportRuler} from '../position/viewport-ruler';
import {ScrollDispatcher} from '@angular/cdk/scrolling';
import {ViewportRuler} from '@angular/cdk/scrolling';
import {
RepositionScrollStrategy,
RepositionScrollStrategyConfig,
Expand Down
9 changes: 9 additions & 0 deletions src/cdk/scrolling/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

export * from './public_api';
24 changes: 24 additions & 0 deletions src/cdk/scrolling/public_api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import {NgModule} from '@angular/core';
import {SCROLL_DISPATCHER_PROVIDER} from './scroll-dispatcher';
import {Scrollable} from './scrollable';
import {PlatformModule} from '@angular/cdk/platform';

@NgModule({
imports: [PlatformModule],
exports: [Scrollable],
declarations: [Scrollable],
providers: [SCROLL_DISPATCHER_PROVIDER],
})
export class ScrollDispatchModule {}

export * from './scroll-dispatcher';
export * from './scrollable';
export * from './viewport-ruler';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {inject, TestBed, async, fakeAsync, ComponentFixture, tick} from '@angular/core/testing';
import {NgModule, Component, ViewChild, ElementRef} from '@angular/core';
import {Scrollable, ScrollDispatcher, ScrollDispatchModule} from './public_api';
import {dispatchFakeEvent} from '@angular/cdk/testing';
import {OverlayModule, Scrollable, ScrollDispatcher} from '../index';

describe('Scroll Dispatcher', () => {

Expand Down Expand Up @@ -176,7 +176,7 @@ class NestedScrollingComponent {

const TEST_COMPONENTS = [ScrollingComponent, NestedScrollingComponent];
@NgModule({
imports: [OverlayModule],
imports: [ScrollDispatchModule],
providers: [ScrollDispatcher],
exports: TEST_COMPONENTS,
declarations: TEST_COMPONENTS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

import {ElementRef, Injectable, NgZone, Optional, SkipSelf} from '@angular/core';
import {Platform} from '@angular/cdk/platform';
import {Scrollable} from './scrollable';
import {Subject} from 'rxjs/Subject';
import {Subscription} from 'rxjs/Subscription';
import {fromEvent} from 'rxjs/observable/fromEvent';
import {merge} from 'rxjs/observable/merge';
import {auditTime} from '../../rxjs/index';
import {auditTime} from 'rxjs/operator/auditTime';
import {Scrollable} from './scrollable';


/** Time in ms to throttle the scrolling events by default. */
Expand Down
File renamed without changes.
13 changes: 13 additions & 0 deletions src/cdk/scrolling/tsconfig-build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "../tsconfig-build",
"files": [
"public_api.ts"
],
"angularCompilerOptions": {
"annotateForClosureCompiler": true,
"strictMetadataEmit": true,
"flatModuleOutFile": "index.js",
"flatModuleId": "@angular/cdk/scrolling",
"skipTemplateCodegen": true
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {TestBed, inject} from '@angular/core/testing';
import {ScrollDispatchModule} from '../scroll/index';
import {ScrollDispatchModule} from './public_api';
import {ViewportRuler, VIEWPORT_RULER_PROVIDER} from './viewport-ruler';


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import {Injectable, Optional, SkipSelf} from '@angular/core';
import {ScrollDispatcher} from '../scroll/scroll-dispatcher';
import {ScrollDispatcher} from './scroll-dispatcher';


/**
Expand Down
1 change: 1 addition & 0 deletions src/demo-app/system-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ System.config({
'@angular/cdk/platform': 'dist/bundles/cdk-platform.umd.js',
'@angular/cdk/portal': 'dist/bundles/cdk-portal.umd.js',
'@angular/cdk/rxjs': 'dist/bundles/cdk-rxjs.umd.js',
'@angular/cdk/scrolling': 'dist/bundles/cdk-scrolling.umd.js',
'@angular/cdk/table': 'dist/bundles/cdk-table.umd.js',
'@angular/cdk/testing': 'dist/bundles/cdk-testing.umd.js',
},
Expand Down
1 change: 1 addition & 0 deletions src/e2e-app/system-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ System.config({
'@angular/cdk/platform': 'dist/bundles/cdk-platform.umd.js',
'@angular/cdk/portal': 'dist/bundles/cdk-portal.umd.js',
'@angular/cdk/rxjs': 'dist/bundles/cdk-rxjs.umd.js',
'@angular/cdk/scrolling': 'dist/bundles/cdk-scrolling.umd.js',
'@angular/cdk/table': 'dist/bundles/cdk-table.umd.js',
'@angular/cdk/testing': 'dist/bundles/cdk-testing.umd.js',
'@angular/material-examples': 'dist/bundles/material-examples.umd.js',
Expand Down
3 changes: 2 additions & 1 deletion src/lib/autocomplete/autocomplete.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {
import {By} from '@angular/platform-browser';
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms';
import {OverlayContainer, ScrollDispatcher} from '@angular/cdk/overlay';
import {ScrollDispatcher} from '@angular/cdk/scrolling';
import {OverlayContainer} from '@angular/cdk/overlay';
import {Direction, Directionality} from '@angular/cdk/bidi';
import {map, RxChain, startWith} from '@angular/cdk/rxjs';
import {createKeyboardEvent, dispatchFakeEvent, typeInElement} from '@angular/cdk/testing';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/button/button.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import {Component, DebugElement} from '@angular/core';
import {By} from '@angular/platform-browser';
import {ViewportRuler} from '@angular/cdk/overlay';
import {ViewportRuler} from '@angular/cdk/scrolling';
import {FakeViewportRuler} from '@angular/cdk/testing';
import {MdButtonModule} from './index';
import {MdRipple} from '../core/ripple/index';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/checkbox/checkbox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import {FormControl, FormsModule, NgModel, ReactiveFormsModule} from '@angular/forms';
import {Component, DebugElement} from '@angular/core';
import {By} from '@angular/platform-browser';
import {ViewportRuler} from '@angular/cdk/overlay';
import {ViewportRuler} from '@angular/cdk/scrolling';
import {dispatchFakeEvent, FakeViewportRuler} from '@angular/cdk/testing';
import {MdCheckbox, MdCheckboxChange, MdCheckboxModule} from './index';
import {RIPPLE_FADE_IN_DURATION, RIPPLE_FADE_OUT_DURATION} from '../core/ripple/ripple-renderer';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/core/ripple/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import {NgModule} from '@angular/core';
import {ScrollDispatchModule, VIEWPORT_RULER_PROVIDER} from '@angular/cdk/overlay';
import {ScrollDispatchModule, VIEWPORT_RULER_PROVIDER} from '@angular/cdk/scrolling';
import {PlatformModule} from '@angular/cdk/platform';
import {MdCommonModule} from '../common-behaviors/common-module';
import {MdRipple} from './ripple';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/core/ripple/ripple-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import {ElementRef, NgZone} from '@angular/core';
import {Platform} from '@angular/cdk/platform';
import {ViewportRuler} from '@angular/cdk/overlay';
import {ViewportRuler} from '@angular/cdk/scrolling';
import {RippleRef, RippleState} from './ripple-ref';


Expand Down
2 changes: 1 addition & 1 deletion src/lib/core/ripple/ripple.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {TestBed, ComponentFixture, fakeAsync, tick, inject} from '@angular/core/testing';
import {Component, ViewChild} from '@angular/core';
import {Platform} from '@angular/cdk/platform';
import {ViewportRuler} from '@angular/cdk/overlay';
import {ViewportRuler} from '@angular/cdk/scrolling';
import {dispatchMouseEvent} from '@angular/cdk/testing';
import {RIPPLE_FADE_OUT_DURATION, RIPPLE_FADE_IN_DURATION} from './ripple-renderer';
import {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/core/ripple/ripple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
InjectionToken,
Optional,
} from '@angular/core';
import {ViewportRuler} from '@angular/cdk/overlay';
import {ViewportRuler} from '@angular/cdk/scrolling';
import {Platform} from '@angular/cdk/platform';
import {RippleConfig, RippleRenderer} from './ripple-renderer';
import {RippleRef} from './ripple-ref';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/radio/radio.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {async, ComponentFixture, fakeAsync, TestBed, tick} from '@angular/core/t
import {FormControl, FormsModule, NgModel, ReactiveFormsModule} from '@angular/forms';
import {Component, DebugElement} from '@angular/core';
import {By} from '@angular/platform-browser';
import {ViewportRuler} from '@angular/cdk/overlay';
import {ViewportRuler} from '@angular/cdk/scrolling';
import {dispatchFakeEvent, FakeViewportRuler} from '@angular/cdk/testing';
import {RIPPLE_FADE_IN_DURATION, RIPPLE_FADE_OUT_DURATION} from '../core/ripple/ripple-renderer';
import {MdRadioButton, MdRadioChange, MdRadioGroup, MdRadioModule} from './index';
Expand Down
3 changes: 2 additions & 1 deletion src/lib/select/select.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import {NoopAnimationsModule} from '@angular/platform-browser/animations';
import {async, ComponentFixture, fakeAsync, inject, TestBed, tick} from '@angular/core/testing';
import {Directionality} from '@angular/cdk/bidi';
import {DOWN_ARROW, END, ENTER, HOME, SPACE, TAB, UP_ARROW} from '@angular/cdk/keycodes';
import {OverlayContainer, ScrollDispatcher, ViewportRuler} from '@angular/cdk/overlay';
import {ScrollDispatcher, ViewportRuler} from '@angular/cdk/scrolling';
import {OverlayContainer} from '@angular/cdk/overlay';
import {dispatchFakeEvent, dispatchKeyboardEvent, wrappedErrorMessage} from '@angular/cdk/testing';
import {Subject} from 'rxjs/Subject';
import {map} from 'rxjs/operator/map';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/tabs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {PortalModule} from '@angular/cdk/portal';
import {ObserversModule} from '@angular/cdk/observers';
import {ScrollDispatchModule, VIEWPORT_RULER_PROVIDER} from '@angular/cdk/overlay';
import {ScrollDispatchModule, VIEWPORT_RULER_PROVIDER} from '@angular/cdk/scrolling';
import {MdCommonModule, MdRippleModule} from '../core';
import {MdTab} from './tab';
import {MdTabGroup} from './tab-group';
Expand Down
Loading

0 comments on commit 0f6a2ec

Please sign in to comment.