cat-documents-ng 0.0.4 → 0.0.6
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 -25
- package/projects/cat-document-lib/README.md +63 -0
- package/projects/cat-document-lib/jest.config.mjs +18 -0
- package/projects/cat-document-lib/ng-package.json +11 -0
- package/projects/cat-document-lib/package-lock.json +599 -0
- package/projects/cat-document-lib/package.json +19 -0
- package/projects/cat-document-lib/setup-jest.ts +10 -0
- package/projects/cat-document-lib/src/Shared/constant/SHARED.ts +232 -0
- package/{Shared/constant/URLS.d.ts → projects/cat-document-lib/src/Shared/constant/URLS.ts} +31 -29
- package/projects/cat-document-lib/src/Shared/services/app-config.service.spec.ts +16 -0
- package/projects/cat-document-lib/src/Shared/services/app-config.service.ts +73 -0
- package/{Shared/services/global-error.handler.d.ts → projects/cat-document-lib/src/Shared/services/global-error.handler.ts} +29 -27
- package/projects/cat-document-lib/src/lib/document/components/document-container/document-container.component.html +6 -0
- package/projects/cat-document-lib/src/lib/document/components/document-container/document-container.component.scss +0 -0
- package/projects/cat-document-lib/src/lib/document/components/document-container/document-container.component.spec.ts +0 -0
- package/projects/cat-document-lib/src/lib/document/components/document-container/document-container.component.ts +82 -0
- package/projects/cat-document-lib/src/lib/document/components/document-list/document-list.component.html +35 -0
- package/projects/cat-document-lib/src/lib/document/components/document-list/document-list.component.scss +12 -0
- package/projects/cat-document-lib/src/lib/document/components/document-list/document-list.component.spec.ts +0 -0
- package/projects/cat-document-lib/src/lib/document/components/document-list/document-list.component.ts +73 -0
- package/projects/cat-document-lib/src/lib/document/components/document-list-item/document-list-item.component.html +33 -0
- package/projects/cat-document-lib/src/lib/document/components/document-list-item/document-list-item.component.scss +22 -0
- package/projects/cat-document-lib/src/lib/document/components/document-list-item/document-list-item.component.spec.ts +23 -0
- package/projects/cat-document-lib/src/lib/document/components/document-list-item/document-list-item.component.ts +40 -0
- package/projects/cat-document-lib/src/lib/document/components/document-upload/document-upload.component.html +56 -0
- package/projects/cat-document-lib/src/lib/document/components/document-upload/document-upload.component.scss +26 -0
- package/projects/cat-document-lib/src/lib/document/components/document-upload/document-upload.component.spec.ts +24 -0
- package/projects/cat-document-lib/src/lib/document/components/document-upload/document-upload.component.ts +184 -0
- package/projects/cat-document-lib/src/lib/document/components/document-viewer/document-viewer.component.html +244 -0
- package/projects/cat-document-lib/src/lib/document/components/document-viewer/document-viewer.component.scss +36 -0
- package/projects/cat-document-lib/src/lib/document/components/document-viewer/document-viewer.component.spec.ts +21 -0
- package/projects/cat-document-lib/src/lib/document/components/document-viewer/document-viewer.component.ts +125 -0
- package/projects/cat-document-lib/src/lib/document/components/folder-block/folder-block.component.html +46 -0
- package/projects/cat-document-lib/src/lib/document/components/folder-block/folder-block.component.scss +0 -0
- package/projects/cat-document-lib/src/lib/document/components/folder-block/folder-block.component.spec.ts +0 -0
- package/{lib/document/components/folder-block/folder-block.component.d.ts → projects/cat-document-lib/src/lib/document/components/folder-block/folder-block.component.ts} +51 -37
- package/projects/cat-document-lib/src/lib/document/components/folder-container/folder-container.component.html +2 -0
- package/projects/cat-document-lib/src/lib/document/components/folder-container/folder-container.component.scss +0 -0
- package/projects/cat-document-lib/src/lib/document/components/folder-container/folder-container.component.spec.ts +0 -0
- package/projects/cat-document-lib/src/lib/document/components/folder-container/folder-container.component.ts +29 -0
- package/projects/cat-document-lib/src/lib/document/document.module.ts +191 -0
- package/projects/cat-document-lib/src/lib/document/models/document.model.ts +39 -0
- package/{lib/document/models/folder.model.d.ts → projects/cat-document-lib/src/lib/document/models/folder.model.ts} +35 -29
- package/projects/cat-document-lib/src/lib/document/services/file-format.service.spec.ts +16 -0
- package/projects/cat-document-lib/src/lib/document/services/file-format.service.ts +41 -0
- package/projects/cat-document-lib/src/lib/document/state/document.query.ts +23 -0
- package/{lib/document/state/document.service.d.ts → projects/cat-document-lib/src/lib/document/state/document.service.ts} +95 -64
- package/{lib/document/state/document.state.d.ts → projects/cat-document-lib/src/lib/document/state/document.state.ts} +39 -30
- package/projects/cat-document-lib/src/lib/document/state/document.store.ts +23 -0
- package/{public-api.d.ts → projects/cat-document-lib/src/public-api.ts} +8 -3
- package/projects/cat-document-lib/tsconfig.lib.json +15 -0
- package/projects/cat-document-lib/tsconfig.lib.prod.json +11 -0
- package/projects/cat-document-lib/tsconfig.spec.json +15 -0
- 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/Shared/constant/SHARED.d.ts +0 -150
- package/Shared/services/app-config.service.d.ts +0 -51
- package/fesm2022/cat-documents-ng.mjs +0 -1411
- package/fesm2022/cat-documents-ng.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/document/components/document-container/document-container.component.d.ts +0 -44
- package/lib/document/components/document-list/document-list.component.d.ts +0 -47
- package/lib/document/components/document-list-item/document-list-item.component.d.ts +0 -28
- package/lib/document/components/document-upload/document-upload.component.d.ts +0 -113
- package/lib/document/components/document-viewer/document-viewer.component.d.ts +0 -113
- package/lib/document/components/folder-container/folder-container.component.d.ts +0 -28
- package/lib/document/document.module.d.ts +0 -35
- package/lib/document/models/document.model.d.ts +0 -33
- package/lib/document/services/file-format.service.d.ts +0 -23
- package/lib/document/state/document.store.d.ts +0 -20
- /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
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
.alert-card {
|
|
2
|
+
background-color: #fb392d1a;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.success-alert {
|
|
6
|
+
border-radius: 10px;
|
|
7
|
+
border: 1px solid rgba(251, 57, 45, 0.1);
|
|
8
|
+
background: linear-gradient(0deg, #dedede 0%, #dedede 100%), #fff;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.p-timeline-event-opposite {
|
|
12
|
+
display: none;
|
|
13
|
+
}
|
|
14
|
+
.decription {
|
|
15
|
+
color: #676b89;
|
|
16
|
+
}
|
|
17
|
+
.textAreaControl textarea {
|
|
18
|
+
width: 100%;
|
|
19
|
+
resize: vertical;
|
|
20
|
+
max-width: 100%;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.document-btn-wrapper {
|
|
24
|
+
.p-button-outlined {
|
|
25
|
+
color: #f57c00;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.document-viewer{
|
|
30
|
+
.p-dialog-header{
|
|
31
|
+
background-color:#ececf9;
|
|
32
|
+
}
|
|
33
|
+
.p-dialog-content{
|
|
34
|
+
background-color:#ececf9;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { DocumentViewerComponent } from './document-viewer.component';
|
|
3
|
+
|
|
4
|
+
describe('DocumentViewerComponent', () => {
|
|
5
|
+
let component: DocumentViewerComponent;
|
|
6
|
+
let fixture: ComponentFixture<DocumentViewerComponent>;
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
await TestBed.configureTestingModule({
|
|
10
|
+
imports: [DocumentViewerComponent],
|
|
11
|
+
}).compileComponents();
|
|
12
|
+
|
|
13
|
+
fixture = TestBed.createComponent(DocumentViewerComponent);
|
|
14
|
+
component = fixture.componentInstance;
|
|
15
|
+
fixture.detectChanges();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should create', () => {
|
|
19
|
+
expect(component).toBeTruthy();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
Input,
|
|
4
|
+
OnInit,
|
|
5
|
+
ViewEncapsulation,
|
|
6
|
+
} from '@angular/core';
|
|
7
|
+
import { DynamicDialogRef } from 'primeng/dynamicdialog';
|
|
8
|
+
import { COUNTRIES, DUMMYSUMMARY, SUPPORTED_IMAGE_TYPES } from '../../../../Shared/constant/SHARED';
|
|
9
|
+
/**
|
|
10
|
+
* For list box data.
|
|
11
|
+
* @interface Country
|
|
12
|
+
* @typedef {Country}
|
|
13
|
+
*/
|
|
14
|
+
interface Country {
|
|
15
|
+
/**
|
|
16
|
+
* For the name of the property.
|
|
17
|
+
* @type {string}
|
|
18
|
+
*/
|
|
19
|
+
name: string;
|
|
20
|
+
/**
|
|
21
|
+
* For the unique code of country.
|
|
22
|
+
* @type {string}
|
|
23
|
+
*/
|
|
24
|
+
code: string;
|
|
25
|
+
/**
|
|
26
|
+
* Mark check or unchecked.
|
|
27
|
+
* @type {?boolean}
|
|
28
|
+
*/
|
|
29
|
+
checked?: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Component for viewing and managing document details.
|
|
34
|
+
* @class DocumentViewerComponent
|
|
35
|
+
* @typedef {DocumentViewerComponent}
|
|
36
|
+
* @implements {OnInit}
|
|
37
|
+
*/
|
|
38
|
+
@Component({
|
|
39
|
+
selector: 'document-viewer',
|
|
40
|
+
templateUrl: './document-viewer.component.html',
|
|
41
|
+
standalone : false,
|
|
42
|
+
styleUrl: './document-viewer.component.scss',
|
|
43
|
+
encapsulation: ViewEncapsulation.None,
|
|
44
|
+
})
|
|
45
|
+
export class DocumentViewerComponent implements OnInit {
|
|
46
|
+
/**
|
|
47
|
+
* Get the selected document by user.
|
|
48
|
+
* @type {*}
|
|
49
|
+
*/
|
|
50
|
+
@Input() selectedDocument: any;
|
|
51
|
+
/**
|
|
52
|
+
* Handle notes data.
|
|
53
|
+
* @type {!string}
|
|
54
|
+
*/
|
|
55
|
+
notes!: string;
|
|
56
|
+
/**
|
|
57
|
+
* Country data according to Country model.
|
|
58
|
+
* @type {!Country[]}
|
|
59
|
+
*/
|
|
60
|
+
countries!: Country[];
|
|
61
|
+
/**
|
|
62
|
+
* Indicates whether a checkbox is selected.
|
|
63
|
+
* @type {boolean}
|
|
64
|
+
*/
|
|
65
|
+
checked: boolean = false;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The currently selected country.
|
|
69
|
+
* @type {Country}
|
|
70
|
+
*/
|
|
71
|
+
selectedCountry!: Country;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Reference to the dynamic dialog used for displaying additional details.
|
|
75
|
+
* @type {(DynamicDialogRef | undefined)}
|
|
76
|
+
*/
|
|
77
|
+
ref: DynamicDialogRef | undefined;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Indicates whether the document has been verified.
|
|
81
|
+
* @type {boolean}
|
|
82
|
+
*/
|
|
83
|
+
isVerified: boolean = false;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Additional property details related to the document.
|
|
87
|
+
* @type {any}
|
|
88
|
+
*/
|
|
89
|
+
propertyDetails: any;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* List of predefined events used for summaries or alerts.
|
|
93
|
+
* @type {*}
|
|
94
|
+
*/
|
|
95
|
+
events = DUMMYSUMMARY;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Data used for displaying alert messages.
|
|
99
|
+
* @type {any}
|
|
100
|
+
*/
|
|
101
|
+
alertData!: any;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Initializes a new instance of the DocumentViewerComponent.
|
|
105
|
+
*/
|
|
106
|
+
constructor() {}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Lifecycle hook that is called after data-bound properties are initialized.
|
|
110
|
+
* Initializes the list of countries.
|
|
111
|
+
*/
|
|
112
|
+
ngOnInit() {
|
|
113
|
+
this.countries = COUNTRIES;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Determines if the given content type is an image.
|
|
119
|
+
* @param {string} contentType - The MIME type of the content.
|
|
120
|
+
* @returns {boolean} `true` if the content type is an image; otherwise, `false`.
|
|
121
|
+
*/
|
|
122
|
+
isImage(contentType: string): boolean {
|
|
123
|
+
return SUPPORTED_IMAGE_TYPES.includes(contentType);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<div class="card folder-info my-4">
|
|
2
|
+
<div class="text-900 text-xl font-semibold mb-3">Folders</div>
|
|
3
|
+
<div class="grid">
|
|
4
|
+
<div *ngFor="let folder of folderBlocks" class="col-12 md:col-6 xl:col-4">
|
|
5
|
+
<div
|
|
6
|
+
class="p-3 border-1 h-full surface-border flex flex-column justify-content-between surface-100 hover:surface-100 cursor-pointer border-round"
|
|
7
|
+
(click)="handleClickForFilter(folder._id)"
|
|
8
|
+
>
|
|
9
|
+
<div class="icon">
|
|
10
|
+
<img src="../../../../assets/images/FolderImg.png" alt="" />
|
|
11
|
+
</div>
|
|
12
|
+
<div class="flex flex-column">
|
|
13
|
+
<span class="text-600 mt-2"> {{ folder.fileCount }} Files </span>
|
|
14
|
+
<span class="text-900 text-lg mt-2 mb-2 font-semibold font-medium">
|
|
15
|
+
{{ folder.text }}
|
|
16
|
+
</span>
|
|
17
|
+
</div>
|
|
18
|
+
<hr />
|
|
19
|
+
<div class="flex justify-content-between">
|
|
20
|
+
<div class="flex flex-column">
|
|
21
|
+
<span>Missing</span>
|
|
22
|
+
<span
|
|
23
|
+
[ngClass]="{
|
|
24
|
+
'text-pink-500': missingFileCount > 0,
|
|
25
|
+
'text-green-500': missingFileCount === 0
|
|
26
|
+
}"
|
|
27
|
+
>
|
|
28
|
+
{{ missingFileCount }}
|
|
29
|
+
</span>
|
|
30
|
+
</div>
|
|
31
|
+
<div class="flex flex-column">
|
|
32
|
+
<span>Pending</span>
|
|
33
|
+
<span
|
|
34
|
+
[ngClass]="{
|
|
35
|
+
'text-yellow-500': pendingFileCount > 0,
|
|
36
|
+
'text-green-500': pendingFileCount === 0
|
|
37
|
+
}"
|
|
38
|
+
>
|
|
39
|
+
{{ pendingFileCount }}
|
|
40
|
+
</span>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
File without changes
|
|
File without changes
|
|
@@ -1,37 +1,51 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
1
|
+
import { Component, Input } from '@angular/core';
|
|
2
|
+
import { DocumentStore } from '../../state/document.store';
|
|
3
|
+
import { FolderBlockModel } from '../../models/folder.model';
|
|
4
|
+
import { SHARED } from '../../../../Shared/constant/SHARED';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The `FolderBlockComponent` is responsible for displaying a block of folders and
|
|
8
|
+
* providing filtering functionality based on folder IDs.
|
|
9
|
+
*
|
|
10
|
+
* It uses data from the `DocumentStore` and constants from the `SHARED` configuration
|
|
11
|
+
* to display missing and pending file counts.
|
|
12
|
+
*/
|
|
13
|
+
@Component({
|
|
14
|
+
selector: 'lib-folder-block',
|
|
15
|
+
standalone: false,
|
|
16
|
+
templateUrl: './folder-block.component.html',
|
|
17
|
+
styleUrl: './folder-block.component.scss'
|
|
18
|
+
})
|
|
19
|
+
export class FolderBlockComponent {
|
|
20
|
+
/**
|
|
21
|
+
* Array of folder blocks data to display.
|
|
22
|
+
* Each folder is represented as a `FolderBlockModel`.
|
|
23
|
+
*/
|
|
24
|
+
@Input() folderBlocks: FolderBlockModel[] = [];
|
|
25
|
+
|
|
26
|
+
/** Number of missing files, sourced from the `SHARED` constants. */
|
|
27
|
+
missingFileCount = SHARED.MISSINGCOUNT;
|
|
28
|
+
|
|
29
|
+
/** Number of pending files, sourced from the `SHARED` constants. */
|
|
30
|
+
pendingFileCount = SHARED.PENDINGCOUNT;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Injects the `DocumentStore` service to manage and access document-related state.
|
|
34
|
+
* @param {DocumentStore} documentStore - The state management store for documents.
|
|
35
|
+
*/
|
|
36
|
+
constructor(public documentStore: DocumentStore) {}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Handles the click event for filtering based on the provided folder ID.
|
|
40
|
+
* This method validates the folder ID and returns it for further processing.
|
|
41
|
+
* If the folder ID is not provided, an empty string is returned.
|
|
42
|
+
* @param {string} folderBlockId - The unique identifier of the folder to filter by.
|
|
43
|
+
* @returns {string} The validated folder ID, or an empty string if the input is invalid.
|
|
44
|
+
*/
|
|
45
|
+
handleClickForFilter(folderBlockId: string): string {
|
|
46
|
+
if (!folderBlockId) {
|
|
47
|
+
return SHARED.EMPTY;
|
|
48
|
+
}
|
|
49
|
+
return folderBlockId;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Component, Input } from '@angular/core';
|
|
2
|
+
import { FOLDERPANEL } from '../../../../Shared/constant/SHARED';
|
|
3
|
+
import { DocumentModel } from '../../models/document.model';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The `FolderContainerComponent` is responsible for rendering a container
|
|
7
|
+
* that displays a list of documents and associated folder panel data.
|
|
8
|
+
*
|
|
9
|
+
* This component utilizes the `FOLDERPANEL` constant for folder panel data
|
|
10
|
+
* and accepts a document list input of type `DocumentModel`.
|
|
11
|
+
*/
|
|
12
|
+
@Component({
|
|
13
|
+
selector: 'lib-folder-container',
|
|
14
|
+
standalone: false,
|
|
15
|
+
templateUrl: './folder-container.component.html',
|
|
16
|
+
styleUrl: './folder-container.component.scss'
|
|
17
|
+
})
|
|
18
|
+
export class FolderContainerComponent {
|
|
19
|
+
/**
|
|
20
|
+
* A list of documents passed as input to the component.
|
|
21
|
+
* Represents the document data to be displayed in the folder container.
|
|
22
|
+
*/
|
|
23
|
+
@Input() documentList?: DocumentModel[];
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Folder blocks data, sourced from the `SHARED` constants.
|
|
27
|
+
*/
|
|
28
|
+
folderBlocks = FOLDERPANEL;
|
|
29
|
+
}
|
|
@@ -0,0 +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 { }
|
|
@@ -0,0 +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,29 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
*
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
+
}
|
|
@@ -0,0 +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
|
+
});
|