Skip to content

Commit f30d36e

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 f24832c commit f30d36e

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

+673
-584
lines changed

src/lib/autocomplete/index.ts

Lines changed: 4 additions & 2 deletions
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

Lines changed: 6 additions & 5 deletions
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

Lines changed: 18 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +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-
UniqueSelectionDispatcher,
25-
coerceBooleanProperty,
26-
UNIQUE_SELECTION_DISPATCHER_PROVIDER,
27-
CompatibilityModule,
28-
} from '../core';
21+
import {UniqueSelectionDispatcher, coerceBooleanProperty} from '../core';
2922

3023
/** Acceptable types for a button toggle. */
3124
export type ToggleType = 'checkbox' | 'radio';
@@ -467,24 +460,3 @@ export class MdButtonToggle implements OnInit {
467460
}
468461
}
469462

470-
471-
@NgModule({
472-
imports: [FormsModule, CompatibilityModule],
473-
exports: [
474-
MdButtonToggleGroup,
475-
MdButtonToggleGroupMultiple,
476-
MdButtonToggle,
477-
CompatibilityModule,
478-
],
479-
declarations: [MdButtonToggleGroup, MdButtonToggleGroupMultiple, MdButtonToggle],
480-
providers: [UNIQUE_SELECTION_DISPATCHER_PROVIDER]
481-
})
482-
export class MdButtonToggleModule {
483-
/** @deprecated */
484-
static forRoot(): ModuleWithProviders {
485-
return {
486-
ngModule: MdButtonToggleModule,
487-
providers: []
488-
};
489-
}
490-
}

src/lib/button-toggle/index.ts

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

src/lib/button/button.spec.ts

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 36 deletions
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.
@@ -220,35 +218,3 @@ export class MdAnchor extends MdButton {
220218
}
221219
}
222220
}
223-
224-
225-
@NgModule({
226-
imports: [CommonModule, MdRippleModule, CompatibilityModule],
227-
exports: [
228-
MdButton, MdAnchor,
229-
CompatibilityModule,
230-
MdButtonCssMatStyler,
231-
MdRaisedButtonCssMatStyler,
232-
MdIconButtonCssMatStyler,
233-
MdFabCssMatStyler,
234-
MdMiniFabCssMatStyler
235-
],
236-
declarations: [
237-
MdButton,
238-
MdAnchor,
239-
MdButtonCssMatStyler,
240-
MdRaisedButtonCssMatStyler,
241-
MdIconButtonCssMatStyler,
242-
MdFabCssMatStyler,
243-
MdMiniFabCssMatStyler
244-
],
245-
})
246-
export class MdButtonModule {
247-
/** @deprecated */
248-
static forRoot(): ModuleWithProviders {
249-
return {
250-
ngModule: MdButtonModule,
251-
providers: []
252-
};
253-
}
254-
}

src/lib/button/index.ts

Lines changed: 47 additions & 0 deletions
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

Lines changed: 0 additions & 39 deletions
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

Lines changed: 56 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {async, fakeAsync, flushMicrotasks, ComponentFixture, TestBed} from '@ang
22
import {NgControl, FormsModule, ReactiveFormsModule, FormControl} from '@angular/forms';
33
import {Component, DebugElement} from '@angular/core';
44
import {By} from '@angular/platform-browser';
5-
import {MdCheckbox, MdCheckboxChange, MdCheckboxModule} from './checkbox';
5+
import {MdCheckbox, MdCheckboxChange, MdCheckboxModule} from './index';
66
import {ViewportRuler} from '../core/overlay/position/viewport-ruler';
77
import {FakeViewportRuler} from '../core/overlay/position/fake-viewport-ruler';
88

0 commit comments

Comments
 (0)