Skip to content

Commit 6250ea8

Browse files
committed
feat: split directives into separate modules (angular-redux#37)
1 parent ae0373d commit 6250ea8

11 files changed

+44
-23
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { NgModule } from '@angular/core';
2+
3+
import { ConnectArray } from './connect-array';
4+
5+
const declarations = [ConnectArray];
6+
7+
@NgModule({
8+
declarations: [...declarations],
9+
exports: [...declarations],
10+
})
11+
export class NgReduxFormConnectArrayModule {}

packages/form/source/connect-array.ts renamed to packages/form/source/connect-array/connect-array.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ import {
3636
} from '@angular/forms';
3737
import {Unsubscribe} from 'redux';
3838

39-
import {ConnectBase} from './connect-base';
40-
import {FormStore} from './form-store';
41-
import {State} from './state';
42-
import {controlPath, selectValueAccessor} from './shims';
39+
import {ConnectBase} from '../connect';
40+
import {FormStore} from '../form-store';
41+
import {State} from '../state';
42+
import {controlPath, selectValueAccessor} from '../shims';
4343

4444
export class ConnectArrayTemplate {
4545
constructor(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './connect-array.module';
2+
export * from './connect-array';

packages/form/source/connect-base.ts renamed to packages/form/source/connect/connect-base.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import { Unsubscribe } from 'redux';
1414

1515
import 'rxjs/add/operator/debounceTime';
1616

17-
import { FormStore } from './form-store';
18-
import { State } from './state';
17+
import { FormStore } from '../form-store';
18+
import { State } from '../state';
1919

2020
export interface ControlPair {
2121
path: Array<string>;

packages/form/source/connect-reactive.ts renamed to packages/form/source/connect/connect-reactive.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
Input,
44
} from '@angular/core';
55

6-
import {FormStore} from './form-store';
6+
import {FormStore} from '../form-store';
77

88
import {ConnectBase} from './connect-base';
99

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { NgModule } from '@angular/core';
2+
3+
import { Connect } from './connect';
4+
import { ReactiveConnect } from './connect-reactive';
5+
6+
const declarations = [Connect, ReactiveConnect];
7+
8+
@NgModule({
9+
declarations: [...declarations],
10+
exports: [...declarations],
11+
})
12+
export class NgReduxFormConnectModule {}

packages/form/source/connect.ts renamed to packages/form/source/connect/connect.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Directive } from '@angular/core';
22

33
import { NgForm } from '@angular/forms';
44

5-
import {FormStore} from './form-store';
5+
import {FormStore} from '../form-store';
66
import {ConnectBase} from './connect-base';
77

88

packages/form/source/connect/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export * from './connect-base';
2+
export * from './connect-reactive';
3+
export * from './connect.module';
4+
export * from './connect';

packages/form/source/index.ts

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ export * from './form-reducer';
33
export * from './form-exception';
44
export * from './form-store';
55
export * from './configure';
6-
export * from './connect-base';
7-
export * from './connect-reactive';
86
export * from './connect';
97
export * from './connect-array';
108
export * from './module';

packages/form/source/module.ts

+7-13
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import {NgModule} from '@angular/core';
22
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
3-
43
import {NgRedux} from '@angular-redux/store';
54

6-
import {ReactiveConnect} from './connect-reactive';
7-
import {Connect} from './connect';
8-
import {ConnectArray} from './connect-array';
5+
import {NgReduxFormConnectModule} from './connect';
6+
import {NgReduxFormConnectArrayModule} from './connect-array';
97
import {FormStore} from './form-store';
108

119
export function formStoreFactory(ngRedux: NgRedux<any>) {
@@ -16,23 +14,19 @@ export function formStoreFactory(ngRedux: NgRedux<any>) {
1614
imports: [
1715
FormsModule,
1816
ReactiveFormsModule,
19-
],
20-
declarations: [
21-
Connect,
22-
ReactiveConnect,
23-
ConnectArray,
17+
NgReduxFormConnectModule,
18+
NgReduxFormConnectArrayModule,
2419
],
2520
exports: [
26-
Connect,
27-
ReactiveConnect,
28-
ConnectArray,
21+
NgReduxFormConnectModule,
22+
NgReduxFormConnectArrayModule
2923
],
3024
providers: [
3125
{
3226
provide: FormStore,
3327
useFactory: formStoreFactory,
3428
deps: [NgRedux],
3529
},
36-
]
30+
],
3731
})
3832
export class NgReduxFormModule {}

0 commit comments

Comments
 (0)