cat-documents-ng 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/PULL_REQUEST_TEMPLATE.md +32 -0
- package/.github/workflows/pr-validation.yml +87 -0
- package/.husky/pre-commit +4 -0
- package/README.md +59 -63
- package/angular.json +119 -0
- package/eslint.config.cjs +148 -0
- package/package.json +66 -19
- package/projects/cat-document-lib/README.md +63 -0
- package/{jest.config.mjs → projects/cat-document-lib/jest.config.mjs} +18 -18
- package/{ng-package.json → projects/cat-document-lib/ng-package.json} +10 -10
- package/projects/cat-document-lib/package-lock.json +599 -0
- package/projects/cat-document-lib/package.json +19 -0
- package/{setup-jest.ts → projects/cat-document-lib/setup-jest.ts} +9 -9
- package/{src/shared → projects/cat-document-lib/src/Shared}/constant/SHARED.ts +231 -231
- package/{src/shared → projects/cat-document-lib/src/Shared}/constant/URLS.ts +31 -31
- package/{src/shared → projects/cat-document-lib/src/Shared}/services/app-config.service.spec.ts +16 -16
- package/{src/shared → projects/cat-document-lib/src/Shared}/services/app-config.service.ts +73 -73
- package/{src/shared → projects/cat-document-lib/src/Shared}/services/global-error.handler.ts +29 -29
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-container/document-container.component.html +5 -5
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-container/document-container.component.ts +82 -82
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-list/document-list.component.html +34 -34
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-list/document-list.component.scss +11 -11
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-list/document-list.component.ts +73 -73
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-list-item/document-list-item.component.html +32 -32
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-list-item/document-list-item.component.scss +21 -21
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-list-item/document-list-item.component.spec.ts +23 -23
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-list-item/document-list-item.component.ts +40 -40
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-upload/document-upload.component.html +55 -55
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-upload/document-upload.component.scss +26 -26
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-upload/document-upload.component.spec.ts +24 -24
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-upload/document-upload.component.ts +184 -184
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-viewer/document-viewer.component.html +244 -244
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-viewer/document-viewer.component.scss +35 -35
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-viewer/document-viewer.component.spec.ts +21 -21
- package/{src → projects/cat-document-lib/src}/lib/document/components/document-viewer/document-viewer.component.ts +125 -125
- package/{src → projects/cat-document-lib/src}/lib/document/components/folder-block/folder-block.component.html +46 -46
- package/{src → projects/cat-document-lib/src}/lib/document/components/folder-block/folder-block.component.ts +51 -51
- package/{src → projects/cat-document-lib/src}/lib/document/components/folder-container/folder-container.component.html +1 -1
- package/{src → projects/cat-document-lib/src}/lib/document/components/folder-container/folder-container.component.ts +29 -29
- package/{src → projects/cat-document-lib/src}/lib/document/document.module.ts +191 -191
- package/{src → projects/cat-document-lib/src}/lib/document/models/document.model.ts +39 -39
- package/{src → projects/cat-document-lib/src}/lib/document/models/folder.model.ts +35 -35
- package/{src → projects/cat-document-lib/src}/lib/document/services/file-format.service.spec.ts +16 -16
- package/{src → projects/cat-document-lib/src}/lib/document/services/file-format.service.ts +41 -41
- package/{src → projects/cat-document-lib/src}/lib/document/state/document.query.ts +23 -23
- package/{src → projects/cat-document-lib/src}/lib/document/state/document.service.ts +95 -95
- package/{src → projects/cat-document-lib/src}/lib/document/state/document.state.ts +39 -39
- package/{src → projects/cat-document-lib/src}/lib/document/state/document.store.ts +23 -23
- package/{src → projects/cat-document-lib/src}/public-api.ts +8 -8
- package/{tsconfig.lib.json → projects/cat-document-lib/tsconfig.lib.json} +15 -15
- package/{tsconfig.lib.prod.json → projects/cat-document-lib/tsconfig.lib.prod.json} +11 -11
- package/{tsconfig.spec.json → projects/cat-document-lib/tsconfig.spec.json} +15 -15
- package/public/favicon.ico +0 -0
- package/src/app/app.component.html +1 -0
- package/src/app/app.component.scss +0 -0
- package/src/app/app.component.spec.ts +29 -0
- package/src/app/app.component.ts +15 -0
- package/src/app/app.module.ts +60 -0
- package/src/app/app.routing.module.ts +19 -0
- package/src/index.html +13 -0
- package/src/main.ts +5 -0
- package/src/styles.scss +39 -0
- package/tsconfig.app.json +15 -0
- package/tsconfig.json +32 -0
- package/src/assets/config/app.config.json +0 -4
- /package/{src → projects/cat-document-lib/src}/assets/images/FolderImg.png +0 -0
- /package/{src → projects/cat-document-lib/src}/assets/images/Frame.png +0 -0
- /package/{src → projects/cat-document-lib/src}/assets/images/document.png +0 -0
- /package/{src → projects/cat-document-lib/src}/lib/document/components/document-container/document-container.component.scss +0 -0
- /package/{src → projects/cat-document-lib/src}/lib/document/components/document-container/document-container.component.spec.ts +0 -0
- /package/{src → projects/cat-document-lib/src}/lib/document/components/document-list/document-list.component.spec.ts +0 -0
- /package/{src → projects/cat-document-lib/src}/lib/document/components/folder-block/folder-block.component.scss +0 -0
- /package/{src → projects/cat-document-lib/src}/lib/document/components/folder-block/folder-block.component.spec.ts +0 -0
- /package/{src → projects/cat-document-lib/src}/lib/document/components/folder-container/folder-container.component.scss +0 -0
- /package/{src → projects/cat-document-lib/src}/lib/document/components/folder-container/folder-container.component.spec.ts +0 -0
|
@@ -1,191 +1,191 @@
|
|
|
1
|
-
import { APP_INITIALIZER, NgModule } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { DocumentContainerComponent } from './components/document-container/document-container.component';
|
|
4
|
-
import { FolderContainerComponent } from './components/folder-container/folder-container.component';
|
|
5
|
-
import { FolderBlockComponent } from './components/folder-block/folder-block.component';
|
|
6
|
-
import { DocumentListComponent } from './components/document-list/document-list.component';
|
|
7
|
-
import { AccordionModule } from 'primeng/accordion';
|
|
8
|
-
import { DocumentListItemComponent } from './components/document-list-item/document-list-item.component';
|
|
9
|
-
import { ButtonModule } from 'primeng/button';
|
|
10
|
-
import { SidebarModule } from 'primeng/sidebar';
|
|
11
|
-
import { FileUploadModule } from 'primeng/fileupload';
|
|
12
|
-
import { DocumentUploadComponent } from './components/document-upload/document-upload.component';
|
|
13
|
-
import { MessageService } from 'primeng/api';
|
|
14
|
-
import { HttpClientModule } from '@angular/common/http';
|
|
15
|
-
import { ProgressBarModule } from 'primeng/progressbar';
|
|
16
|
-
import { BadgeModule } from 'primeng/badge';
|
|
17
|
-
import { ListboxModule } from 'primeng/listbox';
|
|
18
|
-
import { TimelineModule } from 'primeng/timeline';
|
|
19
|
-
import { CheckboxModule } from 'primeng/checkbox';
|
|
20
|
-
import { InputTextareaModule } from 'primeng/inputtextarea';
|
|
21
|
-
import { FormsModule } from '@angular/forms';
|
|
22
|
-
import { DocumentViewerComponent } from './components/document-viewer/document-viewer.component';
|
|
23
|
-
import { PdfViewerModule } from 'ng2-pdf-viewer';
|
|
24
|
-
import { DialogModule } from 'primeng/dialog';
|
|
25
|
-
import { AppConfigService } from '../../Shared/services/app-config.service';
|
|
26
|
-
import { GlobalErrorHandler } from '../../Shared/services/global-error.handler';
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @module DocumentModule
|
|
30
|
-
*
|
|
31
|
-
* The `DocumentModule` handles the organization and display of document and folder components
|
|
32
|
-
* in the application. This module is designed to support features like folder containers,
|
|
33
|
-
* document lists, and individual document items.
|
|
34
|
-
*/
|
|
35
|
-
@NgModule({
|
|
36
|
-
declarations: [
|
|
37
|
-
/**
|
|
38
|
-
* The main container for managing documents.
|
|
39
|
-
* DocumentContainerComponent
|
|
40
|
-
*/
|
|
41
|
-
DocumentContainerComponent,
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* A container component to manage folders.
|
|
45
|
-
* FolderContainerComponent
|
|
46
|
-
*/
|
|
47
|
-
FolderContainerComponent,
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* A block component that represents an individual folder.
|
|
51
|
-
* FolderBlockComponent
|
|
52
|
-
*/
|
|
53
|
-
FolderBlockComponent,
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* A component to display a list of documents.
|
|
57
|
-
* DocumentListComponent
|
|
58
|
-
*/
|
|
59
|
-
DocumentListComponent,
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* A component representing an individual item in the document list.
|
|
63
|
-
* DocumentListItemComponent
|
|
64
|
-
*/
|
|
65
|
-
DocumentListItemComponent,
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* A component representing to upload a file.
|
|
69
|
-
*/
|
|
70
|
-
DocumentUploadComponent,
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* A component representing and allow you to view the document.
|
|
74
|
-
*/
|
|
75
|
-
DocumentViewerComponent,
|
|
76
|
-
|
|
77
|
-
],
|
|
78
|
-
imports: [
|
|
79
|
-
/**
|
|
80
|
-
* Angular's CommonModule is imported to access common directives like `ngIf` and `ngFor`.
|
|
81
|
-
*/
|
|
82
|
-
CommonModule,
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* PrimeNG AccordionModule is used for creating collapsible sections in the UI.
|
|
86
|
-
*/
|
|
87
|
-
AccordionModule,
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* HttpClienModule for the http calls
|
|
91
|
-
*/
|
|
92
|
-
HttpClientModule,
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* PrimeNG ButtonModule is used for creating buttons in the UI.
|
|
96
|
-
*/
|
|
97
|
-
ButtonModule,
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* PrimeNG SidebarModule is used for creating sidebar in the UI.
|
|
101
|
-
*/
|
|
102
|
-
SidebarModule,
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* PrimeNG FileUploadModule is used for uploading file.
|
|
106
|
-
*/
|
|
107
|
-
FileUploadModule,
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* PrimeNG ProgressBarModule is used for showing progress.
|
|
111
|
-
*/
|
|
112
|
-
ProgressBarModule,
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* PrimeNG BadgeModule is used for showing badge value.
|
|
116
|
-
*/
|
|
117
|
-
BadgeModule,
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* PrimeNG ListboxModule is used for showing listbox value.
|
|
121
|
-
*/
|
|
122
|
-
ListboxModule,
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* PrimeNG CheckboxModule is used for showing checkbox value.
|
|
126
|
-
*/
|
|
127
|
-
CheckboxModule,
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* PrimeNG TimelineModule is used for showing timeline value.
|
|
131
|
-
*/
|
|
132
|
-
TimelineModule,
|
|
133
|
-
/**
|
|
134
|
-
* PrimeNG InputTextareaModule is used for showing textarea value.
|
|
135
|
-
*/
|
|
136
|
-
InputTextareaModule,
|
|
137
|
-
/**
|
|
138
|
-
* FormsModule to handle the forms.
|
|
139
|
-
*/
|
|
140
|
-
FormsModule,
|
|
141
|
-
/**
|
|
142
|
-
* PdfViewerModule to handle and make visible the pdf.
|
|
143
|
-
*/
|
|
144
|
-
PdfViewerModule,
|
|
145
|
-
/**
|
|
146
|
-
* PrimeNG DialogModule is used for showing dialog.
|
|
147
|
-
*/
|
|
148
|
-
DialogModule
|
|
149
|
-
],
|
|
150
|
-
exports: [
|
|
151
|
-
/**
|
|
152
|
-
* Exports the `DocumentContainerComponent` to be used in other modules.
|
|
153
|
-
*/
|
|
154
|
-
DocumentContainerComponent,
|
|
155
|
-
/**
|
|
156
|
-
* Exports the `DocumentViewerComponent` to be used in other modules.
|
|
157
|
-
*/
|
|
158
|
-
DocumentViewerComponent
|
|
159
|
-
],
|
|
160
|
-
providers: [
|
|
161
|
-
/**
|
|
162
|
-
* Provide the messageservice to be used in other components.
|
|
163
|
-
*/
|
|
164
|
-
MessageService,
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Provide the messageservice to be used in other components.
|
|
168
|
-
*/
|
|
169
|
-
{ provide: GlobalErrorHandler, useClass: GlobalErrorHandler },
|
|
170
|
-
/**
|
|
171
|
-
* Initializes the application configuration by loading it from the AppConfigService
|
|
172
|
-
* before the application starts.
|
|
173
|
-
* This ensures that the configuration is available for the rest of the app when needed.
|
|
174
|
-
* The configuration is loaded asynchronously using the APP_INITIALIZER.
|
|
175
|
-
* @returns {Function} - A function that loads the configuration from the AppConfigService.
|
|
176
|
-
*/
|
|
177
|
-
{
|
|
178
|
-
provide: APP_INITIALIZER,
|
|
179
|
-
/**
|
|
180
|
-
* This useFactory is executed when the app initializes.
|
|
181
|
-
*/
|
|
182
|
-
useFactory: (configService: AppConfigService) => () =>
|
|
183
|
-
configService.loadAppConfig().catch((error) => {
|
|
184
|
-
throw new Error(error);
|
|
185
|
-
}),
|
|
186
|
-
deps: [AppConfigService],
|
|
187
|
-
multi: true,
|
|
188
|
-
}
|
|
189
|
-
]
|
|
190
|
-
})
|
|
191
|
-
export class DocumentModule { }
|
|
1
|
+
import { APP_INITIALIZER, NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { DocumentContainerComponent } from './components/document-container/document-container.component';
|
|
4
|
+
import { FolderContainerComponent } from './components/folder-container/folder-container.component';
|
|
5
|
+
import { FolderBlockComponent } from './components/folder-block/folder-block.component';
|
|
6
|
+
import { DocumentListComponent } from './components/document-list/document-list.component';
|
|
7
|
+
import { AccordionModule } from 'primeng/accordion';
|
|
8
|
+
import { DocumentListItemComponent } from './components/document-list-item/document-list-item.component';
|
|
9
|
+
import { ButtonModule } from 'primeng/button';
|
|
10
|
+
import { SidebarModule } from 'primeng/sidebar';
|
|
11
|
+
import { FileUploadModule } from 'primeng/fileupload';
|
|
12
|
+
import { DocumentUploadComponent } from './components/document-upload/document-upload.component';
|
|
13
|
+
import { MessageService } from 'primeng/api';
|
|
14
|
+
import { HttpClientModule } from '@angular/common/http';
|
|
15
|
+
import { ProgressBarModule } from 'primeng/progressbar';
|
|
16
|
+
import { BadgeModule } from 'primeng/badge';
|
|
17
|
+
import { ListboxModule } from 'primeng/listbox';
|
|
18
|
+
import { TimelineModule } from 'primeng/timeline';
|
|
19
|
+
import { CheckboxModule } from 'primeng/checkbox';
|
|
20
|
+
import { InputTextareaModule } from 'primeng/inputtextarea';
|
|
21
|
+
import { FormsModule } from '@angular/forms';
|
|
22
|
+
import { DocumentViewerComponent } from './components/document-viewer/document-viewer.component';
|
|
23
|
+
import { PdfViewerModule } from 'ng2-pdf-viewer';
|
|
24
|
+
import { DialogModule } from 'primeng/dialog';
|
|
25
|
+
import { AppConfigService } from '../../Shared/services/app-config.service';
|
|
26
|
+
import { GlobalErrorHandler } from '../../Shared/services/global-error.handler';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @module DocumentModule
|
|
30
|
+
*
|
|
31
|
+
* The `DocumentModule` handles the organization and display of document and folder components
|
|
32
|
+
* in the application. This module is designed to support features like folder containers,
|
|
33
|
+
* document lists, and individual document items.
|
|
34
|
+
*/
|
|
35
|
+
@NgModule({
|
|
36
|
+
declarations: [
|
|
37
|
+
/**
|
|
38
|
+
* The main container for managing documents.
|
|
39
|
+
* DocumentContainerComponent
|
|
40
|
+
*/
|
|
41
|
+
DocumentContainerComponent,
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* A container component to manage folders.
|
|
45
|
+
* FolderContainerComponent
|
|
46
|
+
*/
|
|
47
|
+
FolderContainerComponent,
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* A block component that represents an individual folder.
|
|
51
|
+
* FolderBlockComponent
|
|
52
|
+
*/
|
|
53
|
+
FolderBlockComponent,
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* A component to display a list of documents.
|
|
57
|
+
* DocumentListComponent
|
|
58
|
+
*/
|
|
59
|
+
DocumentListComponent,
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* A component representing an individual item in the document list.
|
|
63
|
+
* DocumentListItemComponent
|
|
64
|
+
*/
|
|
65
|
+
DocumentListItemComponent,
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* A component representing to upload a file.
|
|
69
|
+
*/
|
|
70
|
+
DocumentUploadComponent,
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* A component representing and allow you to view the document.
|
|
74
|
+
*/
|
|
75
|
+
DocumentViewerComponent,
|
|
76
|
+
|
|
77
|
+
],
|
|
78
|
+
imports: [
|
|
79
|
+
/**
|
|
80
|
+
* Angular's CommonModule is imported to access common directives like `ngIf` and `ngFor`.
|
|
81
|
+
*/
|
|
82
|
+
CommonModule,
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* PrimeNG AccordionModule is used for creating collapsible sections in the UI.
|
|
86
|
+
*/
|
|
87
|
+
AccordionModule,
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* HttpClienModule for the http calls
|
|
91
|
+
*/
|
|
92
|
+
HttpClientModule,
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* PrimeNG ButtonModule is used for creating buttons in the UI.
|
|
96
|
+
*/
|
|
97
|
+
ButtonModule,
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* PrimeNG SidebarModule is used for creating sidebar in the UI.
|
|
101
|
+
*/
|
|
102
|
+
SidebarModule,
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* PrimeNG FileUploadModule is used for uploading file.
|
|
106
|
+
*/
|
|
107
|
+
FileUploadModule,
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* PrimeNG ProgressBarModule is used for showing progress.
|
|
111
|
+
*/
|
|
112
|
+
ProgressBarModule,
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* PrimeNG BadgeModule is used for showing badge value.
|
|
116
|
+
*/
|
|
117
|
+
BadgeModule,
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* PrimeNG ListboxModule is used for showing listbox value.
|
|
121
|
+
*/
|
|
122
|
+
ListboxModule,
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* PrimeNG CheckboxModule is used for showing checkbox value.
|
|
126
|
+
*/
|
|
127
|
+
CheckboxModule,
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* PrimeNG TimelineModule is used for showing timeline value.
|
|
131
|
+
*/
|
|
132
|
+
TimelineModule,
|
|
133
|
+
/**
|
|
134
|
+
* PrimeNG InputTextareaModule is used for showing textarea value.
|
|
135
|
+
*/
|
|
136
|
+
InputTextareaModule,
|
|
137
|
+
/**
|
|
138
|
+
* FormsModule to handle the forms.
|
|
139
|
+
*/
|
|
140
|
+
FormsModule,
|
|
141
|
+
/**
|
|
142
|
+
* PdfViewerModule to handle and make visible the pdf.
|
|
143
|
+
*/
|
|
144
|
+
PdfViewerModule,
|
|
145
|
+
/**
|
|
146
|
+
* PrimeNG DialogModule is used for showing dialog.
|
|
147
|
+
*/
|
|
148
|
+
DialogModule
|
|
149
|
+
],
|
|
150
|
+
exports: [
|
|
151
|
+
/**
|
|
152
|
+
* Exports the `DocumentContainerComponent` to be used in other modules.
|
|
153
|
+
*/
|
|
154
|
+
DocumentContainerComponent,
|
|
155
|
+
/**
|
|
156
|
+
* Exports the `DocumentViewerComponent` to be used in other modules.
|
|
157
|
+
*/
|
|
158
|
+
DocumentViewerComponent
|
|
159
|
+
],
|
|
160
|
+
providers: [
|
|
161
|
+
/**
|
|
162
|
+
* Provide the messageservice to be used in other components.
|
|
163
|
+
*/
|
|
164
|
+
MessageService,
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Provide the messageservice to be used in other components.
|
|
168
|
+
*/
|
|
169
|
+
{ provide: GlobalErrorHandler, useClass: GlobalErrorHandler },
|
|
170
|
+
/**
|
|
171
|
+
* Initializes the application configuration by loading it from the AppConfigService
|
|
172
|
+
* before the application starts.
|
|
173
|
+
* This ensures that the configuration is available for the rest of the app when needed.
|
|
174
|
+
* The configuration is loaded asynchronously using the APP_INITIALIZER.
|
|
175
|
+
* @returns {Function} - A function that loads the configuration from the AppConfigService.
|
|
176
|
+
*/
|
|
177
|
+
{
|
|
178
|
+
provide: APP_INITIALIZER,
|
|
179
|
+
/**
|
|
180
|
+
* This useFactory is executed when the app initializes.
|
|
181
|
+
*/
|
|
182
|
+
useFactory: (configService: AppConfigService) => () =>
|
|
183
|
+
configService.loadAppConfig().catch((error) => {
|
|
184
|
+
throw new Error(error);
|
|
185
|
+
}),
|
|
186
|
+
deps: [AppConfigService],
|
|
187
|
+
multi: true,
|
|
188
|
+
}
|
|
189
|
+
]
|
|
190
|
+
})
|
|
191
|
+
export class DocumentModule { }
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { SHARED } from "../../../Shared/constant/SHARED";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Represents a document model.
|
|
5
|
-
*
|
|
6
|
-
* This class contains the structure for document-related data, including file name,
|
|
7
|
-
* status, and document URL.
|
|
8
|
-
*/
|
|
9
|
-
export class DocumentModel {
|
|
10
|
-
/**
|
|
11
|
-
* The unique identifier for the document.
|
|
12
|
-
* @type {number}
|
|
13
|
-
*/
|
|
14
|
-
_id: number = SHARED.INITIAL_COUNT;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* The name of the document file.
|
|
18
|
-
* @type {?string}
|
|
19
|
-
*/
|
|
20
|
-
fileName?: string;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* The current status of the document.
|
|
24
|
-
* @type {?string}
|
|
25
|
-
*/
|
|
26
|
-
status?: string;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* The URL where the document is hosted or stored.
|
|
30
|
-
* @type {?string}
|
|
31
|
-
*/
|
|
32
|
-
documentUrl?: string;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Date of document get uploaded
|
|
36
|
-
* @type {?Date}
|
|
37
|
-
*/
|
|
38
|
-
createdAt?: Date
|
|
39
|
-
}
|
|
1
|
+
import { SHARED } from "../../../Shared/constant/SHARED";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents a document model.
|
|
5
|
+
*
|
|
6
|
+
* This class contains the structure for document-related data, including file name,
|
|
7
|
+
* status, and document URL.
|
|
8
|
+
*/
|
|
9
|
+
export class DocumentModel {
|
|
10
|
+
/**
|
|
11
|
+
* The unique identifier for the document.
|
|
12
|
+
* @type {number}
|
|
13
|
+
*/
|
|
14
|
+
_id: number = SHARED.INITIAL_COUNT;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The name of the document file.
|
|
18
|
+
* @type {?string}
|
|
19
|
+
*/
|
|
20
|
+
fileName?: string;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The current status of the document.
|
|
24
|
+
* @type {?string}
|
|
25
|
+
*/
|
|
26
|
+
status?: string;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The URL where the document is hosted or stored.
|
|
30
|
+
* @type {?string}
|
|
31
|
+
*/
|
|
32
|
+
documentUrl?: string;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Date of document get uploaded
|
|
36
|
+
* @type {?Date}
|
|
37
|
+
*/
|
|
38
|
+
createdAt?: Date
|
|
39
|
+
}
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { SHARED } from "../../../Shared/constant/SHARED";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Represents the model for a folder block.
|
|
5
|
-
*
|
|
6
|
-
* This class provides the structure for folder block data, including properties
|
|
7
|
-
* for ID, file counts, descriptive text, and counts for missing and pending files.
|
|
8
|
-
*/
|
|
9
|
-
export class FolderBlockModel {
|
|
10
|
-
/**
|
|
11
|
-
* Unique identifier for the folder block.
|
|
12
|
-
* Defaults to an empty string sourced from `SHARED.EMPTY`.
|
|
13
|
-
*/
|
|
14
|
-
_id: string = SHARED.EMPTY;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Total number of files within the folder block.
|
|
18
|
-
*/
|
|
19
|
-
fileCount?: number;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Descriptive text associated with the folder block.
|
|
23
|
-
*/
|
|
24
|
-
text?: string;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Number of files marked as missing in the folder block.
|
|
28
|
-
*/
|
|
29
|
-
missingFiles?: number;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Number of files marked as pending in the folder block.
|
|
33
|
-
*/
|
|
34
|
-
pendingFiles?: number;
|
|
35
|
-
}
|
|
1
|
+
import { SHARED } from "../../../Shared/constant/SHARED";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents the model for a folder block.
|
|
5
|
+
*
|
|
6
|
+
* This class provides the structure for folder block data, including properties
|
|
7
|
+
* for ID, file counts, descriptive text, and counts for missing and pending files.
|
|
8
|
+
*/
|
|
9
|
+
export class FolderBlockModel {
|
|
10
|
+
/**
|
|
11
|
+
* Unique identifier for the folder block.
|
|
12
|
+
* Defaults to an empty string sourced from `SHARED.EMPTY`.
|
|
13
|
+
*/
|
|
14
|
+
_id: string = SHARED.EMPTY;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Total number of files within the folder block.
|
|
18
|
+
*/
|
|
19
|
+
fileCount?: number;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Descriptive text associated with the folder block.
|
|
23
|
+
*/
|
|
24
|
+
text?: string;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Number of files marked as missing in the folder block.
|
|
28
|
+
*/
|
|
29
|
+
missingFiles?: number;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Number of files marked as pending in the folder block.
|
|
33
|
+
*/
|
|
34
|
+
pendingFiles?: number;
|
|
35
|
+
}
|
package/{src → projects/cat-document-lib/src}/lib/document/services/file-format.service.spec.ts
RENAMED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { FileFormatService } from './file-format.service';
|
|
4
|
-
|
|
5
|
-
describe('FileFormatService', () => {
|
|
6
|
-
let service: FileFormatService;
|
|
7
|
-
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
TestBed.configureTestingModule({});
|
|
10
|
-
service = TestBed.inject(FileFormatService);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('should be created', () => {
|
|
14
|
-
expect(service).toBeTruthy();
|
|
15
|
-
});
|
|
16
|
-
});
|
|
1
|
+
import { TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { FileFormatService } from './file-format.service';
|
|
4
|
+
|
|
5
|
+
describe('FileFormatService', () => {
|
|
6
|
+
let service: FileFormatService;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
TestBed.configureTestingModule({});
|
|
10
|
+
service = TestBed.inject(FileFormatService);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('should be created', () => {
|
|
14
|
+
expect(service).toBeTruthy();
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { SHARED } from '../../../Shared/constant/SHARED';
|
|
3
|
-
import { PrimeNGConfig } from 'primeng/api';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Description placeholder
|
|
7
|
-
* @class FileFormatService
|
|
8
|
-
* @typedef {FileFormatService}
|
|
9
|
-
*/
|
|
10
|
-
@Injectable({
|
|
11
|
-
providedIn: 'root'
|
|
12
|
-
})
|
|
13
|
-
export class FileFormatService {
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Creates an instance of FileFormatService.
|
|
17
|
-
* @constructor
|
|
18
|
-
*/
|
|
19
|
-
constructor() { }
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Description placeholder
|
|
23
|
-
* @param {number} bytes
|
|
24
|
-
* @param {PrimeNGConfig} config
|
|
25
|
-
* @returns {string}
|
|
26
|
-
*/
|
|
27
|
-
formatFileSize(bytes: number, config:PrimeNGConfig): string {
|
|
28
|
-
const kilobyte = 1024;
|
|
29
|
-
const decimalPlaces = SHARED.ONE;
|
|
30
|
-
const sizes = config.translation.fileSizeTypes || SHARED.FILE_SIZE_UNITS;
|
|
31
|
-
if (bytes < kilobyte) {
|
|
32
|
-
return `${bytes} ${sizes[SHARED.INITIAL_COUNT]}`;
|
|
33
|
-
} else if (bytes < kilobyte * kilobyte) {
|
|
34
|
-
const kbSize = bytes / kilobyte;
|
|
35
|
-
return `${parseFloat(kbSize.toFixed(decimalPlaces))} ${sizes[SHARED.ONE]}`;
|
|
36
|
-
} else {
|
|
37
|
-
const mbSize = bytes / (kilobyte * kilobyte);
|
|
38
|
-
return `${parseFloat(mbSize.toFixed(decimalPlaces))} ${sizes[SHARED.TWO]}`;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { SHARED } from '../../../Shared/constant/SHARED';
|
|
3
|
+
import { PrimeNGConfig } from 'primeng/api';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Description placeholder
|
|
7
|
+
* @class FileFormatService
|
|
8
|
+
* @typedef {FileFormatService}
|
|
9
|
+
*/
|
|
10
|
+
@Injectable({
|
|
11
|
+
providedIn: 'root'
|
|
12
|
+
})
|
|
13
|
+
export class FileFormatService {
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Creates an instance of FileFormatService.
|
|
17
|
+
* @constructor
|
|
18
|
+
*/
|
|
19
|
+
constructor() { }
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Description placeholder
|
|
23
|
+
* @param {number} bytes
|
|
24
|
+
* @param {PrimeNGConfig} config
|
|
25
|
+
* @returns {string}
|
|
26
|
+
*/
|
|
27
|
+
formatFileSize(bytes: number, config:PrimeNGConfig): string {
|
|
28
|
+
const kilobyte = 1024;
|
|
29
|
+
const decimalPlaces = SHARED.ONE;
|
|
30
|
+
const sizes = config.translation.fileSizeTypes || SHARED.FILE_SIZE_UNITS;
|
|
31
|
+
if (bytes < kilobyte) {
|
|
32
|
+
return `${bytes} ${sizes[SHARED.INITIAL_COUNT]}`;
|
|
33
|
+
} else if (bytes < kilobyte * kilobyte) {
|
|
34
|
+
const kbSize = bytes / kilobyte;
|
|
35
|
+
return `${parseFloat(kbSize.toFixed(decimalPlaces))} ${sizes[SHARED.ONE]}`;
|
|
36
|
+
} else {
|
|
37
|
+
const mbSize = bytes / (kilobyte * kilobyte);
|
|
38
|
+
return `${parseFloat(mbSize.toFixed(decimalPlaces))} ${sizes[SHARED.TWO]}`;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|