f1d4467830f21ef3d2acefd5189c18838e419952
[working/Evergreen.git] / Open-ILS / src / eg2 / src / app / common.module.ts
1 /**
2  * Modules, services, and components used by all apps.
3  */
4 import {CommonModule, DatePipe, CurrencyPipe} from '@angular/common';
5 import {NgModule, ModuleWithProviders} from '@angular/core';
6 import {RouterModule} from '@angular/router';
7 import {FormsModule} from '@angular/forms';
8 import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
9
10 /*
11 Note core services are injected into 'root'.
12 They do not have to be added to the providers list.
13 */
14
15 // consider moving these to core...
16 import {FormatService, FormatValuePipe} from '@eg/core/format.service';
17 import {HatchService} from '@eg/share/print/hatch.service';
18 import {PrintService} from '@eg/share/print/print.service';
19
20 // Globally available components
21 import {PrintComponent} from '@eg/share/print/print.component';
22 import {DialogComponent} from '@eg/share/dialog/dialog.component';
23 import {AlertDialogComponent} from '@eg/share/dialog/alert.component';
24 import {ConfirmDialogComponent} from '@eg/share/dialog/confirm.component';
25 import {PromptDialogComponent} from '@eg/share/dialog/prompt.component';
26 import {ProgressInlineComponent} from '@eg/share/dialog/progress-inline.component';
27 import {ProgressDialogComponent} from '@eg/share/dialog/progress.component';
28
29 @NgModule({
30   declarations: [
31     PrintComponent,
32     DialogComponent,
33     AlertDialogComponent,
34     ConfirmDialogComponent,
35     PromptDialogComponent,
36     ProgressInlineComponent,
37     ProgressDialogComponent,
38     FormatValuePipe
39   ],
40   imports: [
41     CommonModule,
42     FormsModule,
43     RouterModule,
44     NgbModule
45   ],
46   exports: [
47     CommonModule,
48     RouterModule,
49     NgbModule,
50     FormsModule,
51     PrintComponent,
52     DialogComponent,
53     AlertDialogComponent,
54     ConfirmDialogComponent,
55     PromptDialogComponent,
56     ProgressInlineComponent,
57     ProgressDialogComponent,
58     FormatValuePipe
59   ]
60 })
61
62 export class EgCommonModule {
63     /** forRoot() lets us define services that should only be
64      * instantiated once for all loaded routes */
65     static forRoot(): ModuleWithProviders {
66         return {
67             ngModule: EgCommonModule,
68             providers: [
69                 DatePipe,
70                 CurrencyPipe,
71                 HatchService,
72                 PrintService,
73                 FormatService
74             ]
75         };
76     }
77 }
78