Skip to content

Commit cfcdae2

Browse files
authored
feat: split directives into separate modules (#37)
1 parent 7df3442 commit cfcdae2

File tree

11 files changed

+44
-23
lines changed

11 files changed

+44
-23
lines changed
Lines changed: 11 additions & 0 deletions
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 {}

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

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

source/connect-array/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './connect-array.module';
2+
export * from './connect-array';

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

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

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

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

source/connect/connect.module.ts

Lines changed: 12 additions & 0 deletions
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 {}
File renamed without changes.

source/connect.ts renamed to source/connect/connect.ts

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

source/connect/index.ts

Lines changed: 4 additions & 0 deletions
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';

source/index.ts

Lines changed: 0 additions & 2 deletions
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';

source/module.ts

Lines changed: 7 additions & 13 deletions
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)