Skip to content

Commit 689c70c

Browse files
committed
refactor: consistent module declaration
Makes the module declarations consistent between components, by moving them all to their respective index.ts files.
1 parent 3ff383c commit 689c70c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+679
-587
lines changed

src/lib/autocomplete/index.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import {MdOptionModule, OverlayModule, OVERLAY_PROVIDERS, CompatibilityModule} f
44
import {CommonModule} from '@angular/common';
55
import {MdAutocomplete} from './autocomplete';
66
import {MdAutocompleteTrigger} from './autocomplete-trigger';
7-
export * from './autocomplete';
8-
export * from './autocomplete-trigger';
97

108
@NgModule({
119
imports: [MdOptionModule, OverlayModule, CompatibilityModule, CommonModule],
@@ -21,3 +19,7 @@ export class MdAutocompleteModule {
2119
};
2220
}
2321
}
22+
23+
24+
export * from './autocomplete';
25+
export * from './autocomplete-trigger';

src/lib/button-toggle/button-toggle.spec.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ import {NgControl, FormsModule, ReactiveFormsModule, FormControl} from '@angular
99
import {Component, DebugElement} from '@angular/core';
1010
import {By} from '@angular/platform-browser';
1111
import {
12-
MdButtonToggleGroup,
13-
MdButtonToggle,
14-
MdButtonToggleGroupMultiple,
15-
MdButtonToggleChange, MdButtonToggleModule,
16-
} from './button-toggle';
12+
MdButtonToggleGroup,
13+
MdButtonToggle,
14+
MdButtonToggleGroupMultiple,
15+
MdButtonToggleChange,
16+
MdButtonToggleModule,
17+
} from './index';
1718

1819

1920
describe('MdButtonToggle', () => {

src/lib/button-toggle/button-toggle.ts

+18-48
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,24 @@
11
import {
2-
NgModule,
3-
ModuleWithProviders,
4-
Component,
5-
ContentChildren,
6-
Directive,
7-
ElementRef,
8-
Renderer,
9-
EventEmitter,
10-
HostBinding,
11-
Input,
12-
OnInit,
13-
Optional,
14-
Output,
15-
QueryList,
16-
ViewChild,
17-
ViewEncapsulation,
18-
forwardRef,
19-
AfterViewInit
2+
Component,
3+
ContentChildren,
4+
Directive,
5+
ElementRef,
6+
Renderer,
7+
EventEmitter,
8+
HostBinding,
9+
Input,
10+
OnInit,
11+
Optional,
12+
Output,
13+
QueryList,
14+
ViewChild,
15+
ViewEncapsulation,
16+
forwardRef,
17+
AfterViewInit,
2018
} from '@angular/core';
21-
import {NG_VALUE_ACCESSOR, ControlValueAccessor, FormsModule} from '@angular/forms';
19+
import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms';
2220
import {Observable} from 'rxjs/Observable';
23-
import {
24-
FocusOriginMonitor,
25-
UniqueSelectionDispatcher,
26-
coerceBooleanProperty,
27-
UNIQUE_SELECTION_DISPATCHER_PROVIDER,
28-
CompatibilityModule,
29-
} from '../core';
21+
import {UniqueSelectionDispatcher, coerceBooleanProperty, FocusOriginMonitor} from '../core';
3022

3123
/** Acceptable types for a button toggle. */
3224
export type ToggleType = 'checkbox' | 'radio';
@@ -469,25 +461,3 @@ export class MdButtonToggle implements OnInit {
469461
this._renderer.invokeElementMethod(this._inputElement.nativeElement, 'focus');
470462
}
471463
}
472-
473-
474-
@NgModule({
475-
imports: [FormsModule, CompatibilityModule],
476-
exports: [
477-
MdButtonToggleGroup,
478-
MdButtonToggleGroupMultiple,
479-
MdButtonToggle,
480-
CompatibilityModule,
481-
],
482-
declarations: [MdButtonToggleGroup, MdButtonToggleGroupMultiple, MdButtonToggle],
483-
providers: [UNIQUE_SELECTION_DISPATCHER_PROVIDER, FocusOriginMonitor]
484-
})
485-
export class MdButtonToggleModule {
486-
/** @deprecated */
487-
static forRoot(): ModuleWithProviders {
488-
return {
489-
ngModule: MdButtonToggleModule,
490-
providers: []
491-
};
492-
}
493-
}

src/lib/button-toggle/index.ts

+32
Original file line numberDiff line numberDiff line change
@@ -1 +1,33 @@
1+
import {NgModule, ModuleWithProviders} from '@angular/core';
2+
import {FormsModule} from '@angular/forms';
3+
import {MdButtonToggleGroup, MdButtonToggleGroupMultiple, MdButtonToggle} from './button-toggle';
4+
import {
5+
UNIQUE_SELECTION_DISPATCHER_PROVIDER,
6+
CompatibilityModule,
7+
FocusOriginMonitor,
8+
} from '../core';
9+
10+
11+
@NgModule({
12+
imports: [FormsModule, CompatibilityModule],
13+
exports: [
14+
MdButtonToggleGroup,
15+
MdButtonToggleGroupMultiple,
16+
MdButtonToggle,
17+
CompatibilityModule,
18+
],
19+
declarations: [MdButtonToggleGroup, MdButtonToggleGroupMultiple, MdButtonToggle],
20+
providers: [UNIQUE_SELECTION_DISPATCHER_PROVIDER, FocusOriginMonitor]
21+
})
22+
export class MdButtonToggleModule {
23+
/** @deprecated */
24+
static forRoot(): ModuleWithProviders {
25+
return {
26+
ngModule: MdButtonToggleModule,
27+
providers: []
28+
};
29+
}
30+
}
31+
32+
133
export * from './button-toggle';

src/lib/button/button.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {async, TestBed, ComponentFixture} from '@angular/core/testing';
22
import {Component} from '@angular/core';
33
import {By} from '@angular/platform-browser';
4-
import {MdButtonModule} from './button';
4+
import {MdButtonModule} from './index';
55
import {ViewportRuler} from '../core/overlay/position/viewport-ruler';
66
import {FakeViewportRuler} from '../core/overlay/position/fake-viewport-ruler';
77

src/lib/button/button.ts

+2-36
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ import {
66
ChangeDetectionStrategy,
77
ElementRef,
88
Renderer,
9-
NgModule,
10-
ModuleWithProviders, Directive,
9+
Directive,
1110
} from '@angular/core';
12-
import {CommonModule} from '@angular/common';
13-
import {MdRippleModule, coerceBooleanProperty, CompatibilityModule} from '../core';
11+
import {coerceBooleanProperty} from '../core';
1412

1513

1614
// TODO(jelbourn): Make the `isMouseDown` stuff done with one global listener.
@@ -219,35 +217,3 @@ export class MdAnchor extends MdButton {
219217
}
220218
}
221219
}
222-
223-
224-
@NgModule({
225-
imports: [CommonModule, MdRippleModule, CompatibilityModule],
226-
exports: [
227-
MdButton, MdAnchor,
228-
CompatibilityModule,
229-
MdButtonCssMatStyler,
230-
MdRaisedButtonCssMatStyler,
231-
MdIconButtonCssMatStyler,
232-
MdFabCssMatStyler,
233-
MdMiniFabCssMatStyler
234-
],
235-
declarations: [
236-
MdButton,
237-
MdAnchor,
238-
MdButtonCssMatStyler,
239-
MdRaisedButtonCssMatStyler,
240-
MdIconButtonCssMatStyler,
241-
MdFabCssMatStyler,
242-
MdMiniFabCssMatStyler
243-
],
244-
})
245-
export class MdButtonModule {
246-
/** @deprecated */
247-
static forRoot(): ModuleWithProviders {
248-
return {
249-
ngModule: MdButtonModule,
250-
providers: []
251-
};
252-
}
253-
}

src/lib/button/index.ts

+47
Original file line numberDiff line numberDiff line change
@@ -1 +1,48 @@
1+
import {NgModule, ModuleWithProviders} from '@angular/core';
2+
import {CommonModule} from '@angular/common';
3+
import {MdRippleModule, CompatibilityModule} from '../core';
4+
import {
5+
MdButton,
6+
MdAnchor,
7+
MdButtonCssMatStyler,
8+
MdRaisedButtonCssMatStyler,
9+
MdIconButtonCssMatStyler,
10+
MdFabCssMatStyler,
11+
MdMiniFabCssMatStyler,
12+
} from './button';
13+
14+
15+
@NgModule({
16+
imports: [CommonModule, MdRippleModule, CompatibilityModule],
17+
exports: [
18+
MdButton,
19+
MdAnchor,
20+
CompatibilityModule,
21+
MdButtonCssMatStyler,
22+
MdRaisedButtonCssMatStyler,
23+
MdIconButtonCssMatStyler,
24+
MdFabCssMatStyler,
25+
MdMiniFabCssMatStyler
26+
],
27+
declarations: [
28+
MdButton,
29+
MdAnchor,
30+
MdButtonCssMatStyler,
31+
MdRaisedButtonCssMatStyler,
32+
MdIconButtonCssMatStyler,
33+
MdFabCssMatStyler,
34+
MdMiniFabCssMatStyler
35+
],
36+
})
37+
export class MdButtonModule {
38+
/** @deprecated */
39+
static forRoot(): ModuleWithProviders {
40+
return {
41+
ngModule: MdButtonModule,
42+
providers: []
43+
};
44+
}
45+
}
46+
47+
148
export * from './button';

src/lib/card/card.ts

-39
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import {
2-
NgModule,
3-
ModuleWithProviders,
42
Component,
53
ViewEncapsulation,
64
ChangeDetectionStrategy,
75
Directive
86
} from '@angular/core';
9-
import {CompatibilityModule} from '../core';
107

118

129
/**
@@ -188,39 +185,3 @@ export class MdCardHeader {}
188185
}
189186
})
190187
export class MdCardTitleGroup {}
191-
192-
193-
@NgModule({
194-
imports: [CompatibilityModule],
195-
exports: [
196-
MdCard,
197-
MdCardHeader,
198-
MdCardTitleGroup,
199-
MdCardContent,
200-
MdCardTitle,
201-
MdCardSubtitle,
202-
MdCardActions,
203-
MdCardFooter,
204-
MdCardSmImage,
205-
MdCardMdImage,
206-
MdCardLgImage,
207-
MdCardImage,
208-
MdCardXlImage,
209-
MdCardAvatar,
210-
CompatibilityModule,
211-
],
212-
declarations: [
213-
MdCard, MdCardHeader, MdCardTitleGroup, MdCardContent, MdCardTitle, MdCardSubtitle,
214-
MdCardActions, MdCardFooter, MdCardSmImage, MdCardMdImage, MdCardLgImage, MdCardImage,
215-
MdCardXlImage, MdCardAvatar,
216-
],
217-
})
218-
export class MdCardModule {
219-
/** @deprecated */
220-
static forRoot(): ModuleWithProviders {
221-
return {
222-
ngModule: MdCardModule,
223-
providers: []
224-
};
225-
}
226-
}

src/lib/card/index.ts

+56
Original file line numberDiff line numberDiff line change
@@ -1 +1,57 @@
1+
import {NgModule, ModuleWithProviders} from '@angular/core';
2+
import {CompatibilityModule} from '../core';
3+
import {
4+
MdCard,
5+
MdCardHeader,
6+
MdCardTitleGroup,
7+
MdCardContent,
8+
MdCardTitle,
9+
MdCardSubtitle,
10+
MdCardActions,
11+
MdCardFooter,
12+
MdCardSmImage,
13+
MdCardMdImage,
14+
MdCardLgImage,
15+
MdCardImage,
16+
MdCardXlImage,
17+
MdCardAvatar,
18+
} from './card';
19+
20+
21+
@NgModule({
22+
imports: [CompatibilityModule],
23+
exports: [
24+
MdCard,
25+
MdCardHeader,
26+
MdCardTitleGroup,
27+
MdCardContent,
28+
MdCardTitle,
29+
MdCardSubtitle,
30+
MdCardActions,
31+
MdCardFooter,
32+
MdCardSmImage,
33+
MdCardMdImage,
34+
MdCardLgImage,
35+
MdCardImage,
36+
MdCardXlImage,
37+
MdCardAvatar,
38+
CompatibilityModule,
39+
],
40+
declarations: [
41+
MdCard, MdCardHeader, MdCardTitleGroup, MdCardContent, MdCardTitle, MdCardSubtitle,
42+
MdCardActions, MdCardFooter, MdCardSmImage, MdCardMdImage, MdCardLgImage, MdCardImage,
43+
MdCardXlImage, MdCardAvatar,
44+
],
45+
})
46+
export class MdCardModule {
47+
/** @deprecated */
48+
static forRoot(): ModuleWithProviders {
49+
return {
50+
ngModule: MdCardModule,
51+
providers: []
52+
};
53+
}
54+
}
55+
56+
157
export * from './card';

src/lib/checkbox/checkbox.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
import {NgControl, FormsModule, ReactiveFormsModule, FormControl} from '@angular/forms';
1010
import {Component, DebugElement} from '@angular/core';
1111
import {By} from '@angular/platform-browser';
12-
import {MdCheckbox, MdCheckboxChange, MdCheckboxModule} from './checkbox';
12+
import {MdCheckbox, MdCheckboxChange, MdCheckboxModule} from './index';
1313
import {ViewportRuler} from '../core/overlay/position/viewport-ruler';
1414
import {FakeViewportRuler} from '../core/overlay/position/fake-viewport-ruler';
1515
import {dispatchFakeEvent} from '../core/testing/dispatch-events';

0 commit comments

Comments
 (0)