Skip to content

Commit

Permalink
refactor: consistent module declaration
Browse files Browse the repository at this point in the history
Makes the module declarations consistent between components, by moving them all to their respective index.ts files.
  • Loading branch information
crisbeto committed Mar 4, 2017
1 parent 3ff383c commit 689c70c
Show file tree
Hide file tree
Showing 62 changed files with 679 additions and 587 deletions.
6 changes: 4 additions & 2 deletions src/lib/autocomplete/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import {MdOptionModule, OverlayModule, OVERLAY_PROVIDERS, CompatibilityModule} f
import {CommonModule} from '@angular/common';
import {MdAutocomplete} from './autocomplete';
import {MdAutocompleteTrigger} from './autocomplete-trigger';
export * from './autocomplete';
export * from './autocomplete-trigger';

@NgModule({
imports: [MdOptionModule, OverlayModule, CompatibilityModule, CommonModule],
Expand All @@ -21,3 +19,7 @@ export class MdAutocompleteModule {
};
}
}


export * from './autocomplete';
export * from './autocomplete-trigger';
11 changes: 6 additions & 5 deletions src/lib/button-toggle/button-toggle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import {NgControl, FormsModule, ReactiveFormsModule, FormControl} from '@angular
import {Component, DebugElement} from '@angular/core';
import {By} from '@angular/platform-browser';
import {
MdButtonToggleGroup,
MdButtonToggle,
MdButtonToggleGroupMultiple,
MdButtonToggleChange, MdButtonToggleModule,
} from './button-toggle';
MdButtonToggleGroup,
MdButtonToggle,
MdButtonToggleGroupMultiple,
MdButtonToggleChange,
MdButtonToggleModule,
} from './index';


describe('MdButtonToggle', () => {
Expand Down
66 changes: 18 additions & 48 deletions src/lib/button-toggle/button-toggle.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,24 @@
import {
NgModule,
ModuleWithProviders,
Component,
ContentChildren,
Directive,
ElementRef,
Renderer,
EventEmitter,
HostBinding,
Input,
OnInit,
Optional,
Output,
QueryList,
ViewChild,
ViewEncapsulation,
forwardRef,
AfterViewInit
Component,
ContentChildren,
Directive,
ElementRef,
Renderer,
EventEmitter,
HostBinding,
Input,
OnInit,
Optional,
Output,
QueryList,
ViewChild,
ViewEncapsulation,
forwardRef,
AfterViewInit,
} from '@angular/core';
import {NG_VALUE_ACCESSOR, ControlValueAccessor, FormsModule} from '@angular/forms';
import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms';
import {Observable} from 'rxjs/Observable';
import {
FocusOriginMonitor,
UniqueSelectionDispatcher,
coerceBooleanProperty,
UNIQUE_SELECTION_DISPATCHER_PROVIDER,
CompatibilityModule,
} from '../core';
import {UniqueSelectionDispatcher, coerceBooleanProperty, FocusOriginMonitor} from '../core';

/** Acceptable types for a button toggle. */
export type ToggleType = 'checkbox' | 'radio';
Expand Down Expand Up @@ -469,25 +461,3 @@ export class MdButtonToggle implements OnInit {
this._renderer.invokeElementMethod(this._inputElement.nativeElement, 'focus');
}
}


@NgModule({
imports: [FormsModule, CompatibilityModule],
exports: [
MdButtonToggleGroup,
MdButtonToggleGroupMultiple,
MdButtonToggle,
CompatibilityModule,
],
declarations: [MdButtonToggleGroup, MdButtonToggleGroupMultiple, MdButtonToggle],
providers: [UNIQUE_SELECTION_DISPATCHER_PROVIDER, FocusOriginMonitor]
})
export class MdButtonToggleModule {
/** @deprecated */
static forRoot(): ModuleWithProviders {
return {
ngModule: MdButtonToggleModule,
providers: []
};
}
}
32 changes: 32 additions & 0 deletions src/lib/button-toggle/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,33 @@
import {NgModule, ModuleWithProviders} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {MdButtonToggleGroup, MdButtonToggleGroupMultiple, MdButtonToggle} from './button-toggle';
import {
UNIQUE_SELECTION_DISPATCHER_PROVIDER,
CompatibilityModule,
FocusOriginMonitor,
} from '../core';


@NgModule({
imports: [FormsModule, CompatibilityModule],
exports: [
MdButtonToggleGroup,
MdButtonToggleGroupMultiple,
MdButtonToggle,
CompatibilityModule,
],
declarations: [MdButtonToggleGroup, MdButtonToggleGroupMultiple, MdButtonToggle],
providers: [UNIQUE_SELECTION_DISPATCHER_PROVIDER, FocusOriginMonitor]
})
export class MdButtonToggleModule {
/** @deprecated */
static forRoot(): ModuleWithProviders {
return {
ngModule: MdButtonToggleModule,
providers: []
};
}
}


export * from './button-toggle';
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, TestBed, ComponentFixture} from '@angular/core/testing';
import {Component} from '@angular/core';
import {By} from '@angular/platform-browser';
import {MdButtonModule} from './button';
import {MdButtonModule} from './index';
import {ViewportRuler} from '../core/overlay/position/viewport-ruler';
import {FakeViewportRuler} from '../core/overlay/position/fake-viewport-ruler';

Expand Down
38 changes: 2 additions & 36 deletions src/lib/button/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ import {
ChangeDetectionStrategy,
ElementRef,
Renderer,
NgModule,
ModuleWithProviders, Directive,
Directive,
} from '@angular/core';
import {CommonModule} from '@angular/common';
import {MdRippleModule, coerceBooleanProperty, CompatibilityModule} from '../core';
import {coerceBooleanProperty} from '../core';


// TODO(jelbourn): Make the `isMouseDown` stuff done with one global listener.
Expand Down Expand Up @@ -219,35 +217,3 @@ export class MdAnchor extends MdButton {
}
}
}


@NgModule({
imports: [CommonModule, MdRippleModule, CompatibilityModule],
exports: [
MdButton, MdAnchor,
CompatibilityModule,
MdButtonCssMatStyler,
MdRaisedButtonCssMatStyler,
MdIconButtonCssMatStyler,
MdFabCssMatStyler,
MdMiniFabCssMatStyler
],
declarations: [
MdButton,
MdAnchor,
MdButtonCssMatStyler,
MdRaisedButtonCssMatStyler,
MdIconButtonCssMatStyler,
MdFabCssMatStyler,
MdMiniFabCssMatStyler
],
})
export class MdButtonModule {
/** @deprecated */
static forRoot(): ModuleWithProviders {
return {
ngModule: MdButtonModule,
providers: []
};
}
}
47 changes: 47 additions & 0 deletions src/lib/button/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,48 @@
import {NgModule, ModuleWithProviders} from '@angular/core';
import {CommonModule} from '@angular/common';
import {MdRippleModule, CompatibilityModule} from '../core';
import {
MdButton,
MdAnchor,
MdButtonCssMatStyler,
MdRaisedButtonCssMatStyler,
MdIconButtonCssMatStyler,
MdFabCssMatStyler,
MdMiniFabCssMatStyler,
} from './button';


@NgModule({
imports: [CommonModule, MdRippleModule, CompatibilityModule],
exports: [
MdButton,
MdAnchor,
CompatibilityModule,
MdButtonCssMatStyler,
MdRaisedButtonCssMatStyler,
MdIconButtonCssMatStyler,
MdFabCssMatStyler,
MdMiniFabCssMatStyler
],
declarations: [
MdButton,
MdAnchor,
MdButtonCssMatStyler,
MdRaisedButtonCssMatStyler,
MdIconButtonCssMatStyler,
MdFabCssMatStyler,
MdMiniFabCssMatStyler
],
})
export class MdButtonModule {
/** @deprecated */
static forRoot(): ModuleWithProviders {
return {
ngModule: MdButtonModule,
providers: []
};
}
}


export * from './button';
39 changes: 0 additions & 39 deletions src/lib/card/card.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import {
NgModule,
ModuleWithProviders,
Component,
ViewEncapsulation,
ChangeDetectionStrategy,
Directive
} from '@angular/core';
import {CompatibilityModule} from '../core';


/**
Expand Down Expand Up @@ -188,39 +185,3 @@ export class MdCardHeader {}
}
})
export class MdCardTitleGroup {}


@NgModule({
imports: [CompatibilityModule],
exports: [
MdCard,
MdCardHeader,
MdCardTitleGroup,
MdCardContent,
MdCardTitle,
MdCardSubtitle,
MdCardActions,
MdCardFooter,
MdCardSmImage,
MdCardMdImage,
MdCardLgImage,
MdCardImage,
MdCardXlImage,
MdCardAvatar,
CompatibilityModule,
],
declarations: [
MdCard, MdCardHeader, MdCardTitleGroup, MdCardContent, MdCardTitle, MdCardSubtitle,
MdCardActions, MdCardFooter, MdCardSmImage, MdCardMdImage, MdCardLgImage, MdCardImage,
MdCardXlImage, MdCardAvatar,
],
})
export class MdCardModule {
/** @deprecated */
static forRoot(): ModuleWithProviders {
return {
ngModule: MdCardModule,
providers: []
};
}
}
56 changes: 56 additions & 0 deletions src/lib/card/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,57 @@
import {NgModule, ModuleWithProviders} from '@angular/core';
import {CompatibilityModule} from '../core';
import {
MdCard,
MdCardHeader,
MdCardTitleGroup,
MdCardContent,
MdCardTitle,
MdCardSubtitle,
MdCardActions,
MdCardFooter,
MdCardSmImage,
MdCardMdImage,
MdCardLgImage,
MdCardImage,
MdCardXlImage,
MdCardAvatar,
} from './card';


@NgModule({
imports: [CompatibilityModule],
exports: [
MdCard,
MdCardHeader,
MdCardTitleGroup,
MdCardContent,
MdCardTitle,
MdCardSubtitle,
MdCardActions,
MdCardFooter,
MdCardSmImage,
MdCardMdImage,
MdCardLgImage,
MdCardImage,
MdCardXlImage,
MdCardAvatar,
CompatibilityModule,
],
declarations: [
MdCard, MdCardHeader, MdCardTitleGroup, MdCardContent, MdCardTitle, MdCardSubtitle,
MdCardActions, MdCardFooter, MdCardSmImage, MdCardMdImage, MdCardLgImage, MdCardImage,
MdCardXlImage, MdCardAvatar,
],
})
export class MdCardModule {
/** @deprecated */
static forRoot(): ModuleWithProviders {
return {
ngModule: MdCardModule,
providers: []
};
}
}


export * from './card';
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 {NgControl, FormsModule, ReactiveFormsModule, FormControl} from '@angular/forms';
import {Component, DebugElement} from '@angular/core';
import {By} from '@angular/platform-browser';
import {MdCheckbox, MdCheckboxChange, MdCheckboxModule} from './checkbox';
import {MdCheckbox, MdCheckboxChange, MdCheckboxModule} from './index';
import {ViewportRuler} from '../core/overlay/position/viewport-ruler';
import {FakeViewportRuler} from '../core/overlay/position/fake-viewport-ruler';
import {dispatchFakeEvent} from '../core/testing/dispatch-events';
Expand Down
Loading

0 comments on commit 689c70c

Please sign in to comment.