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,73 +1,73 @@
|
|
|
1
|
-
import { HttpClient } from '@angular/common/http';
|
|
2
|
-
import { Injectable } from '@angular/core';
|
|
3
|
-
import { firstValueFrom } from 'rxjs';
|
|
4
|
-
import { URLS } from '../constant/URLS';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Service that handles loading and providing configuration settings for the application.
|
|
8
|
-
* It fetches configuration data from a remote server and exposes various configuration options.
|
|
9
|
-
* @class AppConfigService
|
|
10
|
-
* @typedef {AppConfigService}
|
|
11
|
-
*/
|
|
12
|
-
@Injectable({
|
|
13
|
-
providedIn: 'root'
|
|
14
|
-
})
|
|
15
|
-
export class AppConfigService {
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Holds the configuration data loaded from the server.
|
|
19
|
-
* @private
|
|
20
|
-
* @type {*}
|
|
21
|
-
*/
|
|
22
|
-
private appConfig: any;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Creates an instance of AppConfigService.
|
|
26
|
-
* Initializes the HttpClient for making HTTP requests.
|
|
27
|
-
* @class
|
|
28
|
-
* @param {HttpClient} http - The HttpClient service used for making HTTP requests.
|
|
29
|
-
*/
|
|
30
|
-
constructor(private http: HttpClient) {}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Loads the application configuration from the server by making an HTTP request to the configuration URL.
|
|
34
|
-
* This method retrieves the configuration data and assigns it to the appConfig property.
|
|
35
|
-
* @async
|
|
36
|
-
* @returns {*}
|
|
37
|
-
*/
|
|
38
|
-
async loadAppConfig() {
|
|
39
|
-
try {
|
|
40
|
-
this.appConfig = await firstValueFrom(this.http.get(URLS.CONFIGFILEURL));
|
|
41
|
-
} catch (error) {
|
|
42
|
-
throw new Error("Api url is missing.")
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Returns the base URL for the API from the loaded configuration.
|
|
49
|
-
* @readonly
|
|
50
|
-
* @type {*}
|
|
51
|
-
*/
|
|
52
|
-
get apiBaseUrl() {
|
|
53
|
-
return this.appConfig?.apiUrl;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Returns the local server API URL from the loaded configuration.
|
|
58
|
-
* @readonly
|
|
59
|
-
* @type {*}
|
|
60
|
-
*/
|
|
61
|
-
get localServerApi() {
|
|
62
|
-
return this.appConfig?.localServerApi;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Returns the visibility options from the loaded configuration.
|
|
67
|
-
* @readonly
|
|
68
|
-
* @type {*}
|
|
69
|
-
*/
|
|
70
|
-
get visibilityOptions() {
|
|
71
|
-
return this.appConfig?.visibilityOption;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
1
|
+
import { HttpClient } from '@angular/common/http';
|
|
2
|
+
import { Injectable } from '@angular/core';
|
|
3
|
+
import { firstValueFrom } from 'rxjs';
|
|
4
|
+
import { URLS } from '../constant/URLS';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Service that handles loading and providing configuration settings for the application.
|
|
8
|
+
* It fetches configuration data from a remote server and exposes various configuration options.
|
|
9
|
+
* @class AppConfigService
|
|
10
|
+
* @typedef {AppConfigService}
|
|
11
|
+
*/
|
|
12
|
+
@Injectable({
|
|
13
|
+
providedIn: 'root'
|
|
14
|
+
})
|
|
15
|
+
export class AppConfigService {
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Holds the configuration data loaded from the server.
|
|
19
|
+
* @private
|
|
20
|
+
* @type {*}
|
|
21
|
+
*/
|
|
22
|
+
private appConfig: any;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Creates an instance of AppConfigService.
|
|
26
|
+
* Initializes the HttpClient for making HTTP requests.
|
|
27
|
+
* @class
|
|
28
|
+
* @param {HttpClient} http - The HttpClient service used for making HTTP requests.
|
|
29
|
+
*/
|
|
30
|
+
constructor(private http: HttpClient) {}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Loads the application configuration from the server by making an HTTP request to the configuration URL.
|
|
34
|
+
* This method retrieves the configuration data and assigns it to the appConfig property.
|
|
35
|
+
* @async
|
|
36
|
+
* @returns {*}
|
|
37
|
+
*/
|
|
38
|
+
async loadAppConfig() {
|
|
39
|
+
try {
|
|
40
|
+
this.appConfig = await firstValueFrom(this.http.get(URLS.CONFIGFILEURL));
|
|
41
|
+
} catch (error) {
|
|
42
|
+
throw new Error("Api url is missing.")
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Returns the base URL for the API from the loaded configuration.
|
|
49
|
+
* @readonly
|
|
50
|
+
* @type {*}
|
|
51
|
+
*/
|
|
52
|
+
get apiBaseUrl() {
|
|
53
|
+
return this.appConfig?.apiUrl;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Returns the local server API URL from the loaded configuration.
|
|
58
|
+
* @readonly
|
|
59
|
+
* @type {*}
|
|
60
|
+
*/
|
|
61
|
+
get localServerApi() {
|
|
62
|
+
return this.appConfig?.localServerApi;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Returns the visibility options from the loaded configuration.
|
|
67
|
+
* @readonly
|
|
68
|
+
* @type {*}
|
|
69
|
+
*/
|
|
70
|
+
get visibilityOptions() {
|
|
71
|
+
return this.appConfig?.visibilityOption;
|
|
72
|
+
}
|
|
73
|
+
}
|
package/{src/shared → projects/cat-document-lib/src/Shared}/services/global-error.handler.ts
RENAMED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { ErrorHandler, Injectable, Injector } from '@angular/core';
|
|
2
|
-
import { HttpErrorResponse } from '@angular/common/http';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* GlobalErrorHandler is a custom error handler that implements the ErrorHandler interface.
|
|
6
|
-
* It is used to handle both HTTP errors and other types of errors globally in the application.
|
|
7
|
-
* @class
|
|
8
|
-
* @implements {ErrorHandler}
|
|
9
|
-
* @decorator {Injectable}
|
|
10
|
-
*/
|
|
11
|
-
@Injectable()
|
|
12
|
-
export class GlobalErrorHandler implements ErrorHandler {
|
|
13
|
-
/**
|
|
14
|
-
* Creates an instance of GlobalErrorHandler.
|
|
15
|
-
* @constructor
|
|
16
|
-
* @param {Injector} injector - The Angular injector used to get instances of services.
|
|
17
|
-
*/
|
|
18
|
-
constructor(private injector: Injector) { }
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Handles errors globally in the application.
|
|
22
|
-
*
|
|
23
|
-
* @param {any} error - The error object that needs to be handled.
|
|
24
|
-
* @returns {void}
|
|
25
|
-
*/
|
|
26
|
-
handleError(error: any): void {
|
|
27
|
-
console.error('GlobalErrorHandler:', error);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
1
|
+
import { ErrorHandler, Injectable, Injector } from '@angular/core';
|
|
2
|
+
import { HttpErrorResponse } from '@angular/common/http';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* GlobalErrorHandler is a custom error handler that implements the ErrorHandler interface.
|
|
6
|
+
* It is used to handle both HTTP errors and other types of errors globally in the application.
|
|
7
|
+
* @class
|
|
8
|
+
* @implements {ErrorHandler}
|
|
9
|
+
* @decorator {Injectable}
|
|
10
|
+
*/
|
|
11
|
+
@Injectable()
|
|
12
|
+
export class GlobalErrorHandler implements ErrorHandler {
|
|
13
|
+
/**
|
|
14
|
+
* Creates an instance of GlobalErrorHandler.
|
|
15
|
+
* @constructor
|
|
16
|
+
* @param {Injector} injector - The Angular injector used to get instances of services.
|
|
17
|
+
*/
|
|
18
|
+
constructor(private injector: Injector) { }
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Handles errors globally in the application.
|
|
22
|
+
*
|
|
23
|
+
* @param {any} error - The error object that needs to be handled.
|
|
24
|
+
* @returns {void}
|
|
25
|
+
*/
|
|
26
|
+
handleError(error: any): void {
|
|
27
|
+
console.error('GlobalErrorHandler:', error);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
<div class="grid m-0">
|
|
2
|
-
<div class="col-12 md:col-12 lg:col-12 overflow-y-scroll py-0 pl-0" >
|
|
3
|
-
<lib-folder-container [documentList]="documentList"></lib-folder-container>
|
|
4
|
-
<lib-document-list [documentList]="documentList"></lib-document-list>
|
|
5
|
-
</div>
|
|
1
|
+
<div class="grid m-0">
|
|
2
|
+
<div class="col-12 md:col-12 lg:col-12 overflow-y-scroll py-0 pl-0" >
|
|
3
|
+
<lib-folder-container [documentList]="documentList"></lib-folder-container>
|
|
4
|
+
<lib-document-list [documentList]="documentList"></lib-document-list>
|
|
5
|
+
</div>
|
|
6
6
|
</div>
|
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
-
import { SHARED } from '../../../../Shared/constant/SHARED';
|
|
3
|
-
import { DocumentService } from '../../state/document.service';
|
|
4
|
-
import { DocumentModel } from '../../models/document.model';
|
|
5
|
-
import { URLS } from '../../../../Shared/constant/URLS';
|
|
6
|
-
import { Subscription } from 'rxjs';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
*This component is responsible for managing and displaying a list of documents.
|
|
11
|
-
* @class DocumentContainerComponent
|
|
12
|
-
* @typedef {DocumentContainerComponent}
|
|
13
|
-
*/
|
|
14
|
-
@Component({
|
|
15
|
-
selector: 'lib-document-container',
|
|
16
|
-
standalone: false,
|
|
17
|
-
templateUrl: './document-container.component.html',
|
|
18
|
-
styleUrl: './document-container.component.scss'
|
|
19
|
-
})
|
|
20
|
-
export class DocumentContainerComponent implements OnInit{
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Creates an instance of DocumentContainerComponent.
|
|
24
|
-
* @class
|
|
25
|
-
* @param {DocumentService} documentService - Service to manage document-related operations.
|
|
26
|
-
*/
|
|
27
|
-
constructor(public documentService : DocumentService){
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Get contextId in input.
|
|
32
|
-
* @type {string}
|
|
33
|
-
*/
|
|
34
|
-
@Input() contextId : string =
|
|
35
|
-
/**
|
|
36
|
-
* The list of dummy documents.
|
|
37
|
-
* @type {Array}
|
|
38
|
-
*/
|
|
39
|
-
documentList : DocumentModel[] = []
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Holds the subscription to manage observable cleanup.
|
|
43
|
-
* @private
|
|
44
|
-
* @type {Subscription}
|
|
45
|
-
*/
|
|
46
|
-
private subscription: Subscription = new Subscription();
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Call document service method to get the document by contextId.
|
|
50
|
-
*/
|
|
51
|
-
ngOnInit(): void {
|
|
52
|
-
const documentSubscription = this.documentService
|
|
53
|
-
.getById(`${URLS.CONTEXT}${this.contextId}`)
|
|
54
|
-
.subscribe({
|
|
55
|
-
/**
|
|
56
|
-
* Handles the successful API response.
|
|
57
|
-
* @param {DocumentModel[]} res - The list of documents returned by the API.
|
|
58
|
-
*/
|
|
59
|
-
next: (res: DocumentModel[]) => {
|
|
60
|
-
if (res) {
|
|
61
|
-
this.documentList = res;
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
/**
|
|
65
|
-
* Handles errors that occur during the API call.
|
|
66
|
-
* Logs the error to the console.
|
|
67
|
-
* @param {any} err - The error object returned from the API.
|
|
68
|
-
*/
|
|
69
|
-
error: (err) => {
|
|
70
|
-
throw new Error(err)
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
this.subscription.add(documentSubscription);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Unsubscribe subscription on destroy of component .
|
|
78
|
-
*/
|
|
79
|
-
ngOnDestroy(): void {
|
|
80
|
-
this.subscription.unsubscribe();
|
|
81
|
-
}
|
|
82
|
-
}
|
|
1
|
+
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
+
import { SHARED } from '../../../../Shared/constant/SHARED';
|
|
3
|
+
import { DocumentService } from '../../state/document.service';
|
|
4
|
+
import { DocumentModel } from '../../models/document.model';
|
|
5
|
+
import { URLS } from '../../../../Shared/constant/URLS';
|
|
6
|
+
import { Subscription } from 'rxjs';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
*This component is responsible for managing and displaying a list of documents.
|
|
11
|
+
* @class DocumentContainerComponent
|
|
12
|
+
* @typedef {DocumentContainerComponent}
|
|
13
|
+
*/
|
|
14
|
+
@Component({
|
|
15
|
+
selector: 'lib-document-container',
|
|
16
|
+
standalone: false,
|
|
17
|
+
templateUrl: './document-container.component.html',
|
|
18
|
+
styleUrl: './document-container.component.scss'
|
|
19
|
+
})
|
|
20
|
+
export class DocumentContainerComponent implements OnInit{
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Creates an instance of DocumentContainerComponent.
|
|
24
|
+
* @class
|
|
25
|
+
* @param {DocumentService} documentService - Service to manage document-related operations.
|
|
26
|
+
*/
|
|
27
|
+
constructor(public documentService : DocumentService){
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Get contextId in input.
|
|
32
|
+
* @type {string}
|
|
33
|
+
*/
|
|
34
|
+
@Input() contextId : string = "786755";
|
|
35
|
+
/**
|
|
36
|
+
* The list of dummy documents.
|
|
37
|
+
* @type {Array}
|
|
38
|
+
*/
|
|
39
|
+
documentList : DocumentModel[] = []
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Holds the subscription to manage observable cleanup.
|
|
43
|
+
* @private
|
|
44
|
+
* @type {Subscription}
|
|
45
|
+
*/
|
|
46
|
+
private subscription: Subscription = new Subscription();
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Call document service method to get the document by contextId.
|
|
50
|
+
*/
|
|
51
|
+
ngOnInit(): void {
|
|
52
|
+
const documentSubscription = this.documentService
|
|
53
|
+
.getById(`${URLS.CONTEXT}${this.contextId}`)
|
|
54
|
+
.subscribe({
|
|
55
|
+
/**
|
|
56
|
+
* Handles the successful API response.
|
|
57
|
+
* @param {DocumentModel[]} res - The list of documents returned by the API.
|
|
58
|
+
*/
|
|
59
|
+
next: (res: DocumentModel[]) => {
|
|
60
|
+
if (res) {
|
|
61
|
+
this.documentList = res;
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
/**
|
|
65
|
+
* Handles errors that occur during the API call.
|
|
66
|
+
* Logs the error to the console.
|
|
67
|
+
* @param {any} err - The error object returned from the API.
|
|
68
|
+
*/
|
|
69
|
+
error: (err) => {
|
|
70
|
+
throw new Error(err)
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
this.subscription.add(documentSubscription);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Unsubscribe subscription on destroy of component .
|
|
78
|
+
*/
|
|
79
|
+
ngOnDestroy(): void {
|
|
80
|
+
this.subscription.unsubscribe();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
<div class="document-viewer">
|
|
2
|
-
<p-dialog [(visible)]="isdialogVisible" [modal]="true" (onHide)="handleCloseModel()" [style]="{ width: '100vw' }"
|
|
3
|
-
[draggable]="false" [closable]="true">
|
|
4
|
-
<document-viewer [selectedDocument]="selectedDocument"></document-viewer>
|
|
5
|
-
</p-dialog>
|
|
6
|
-
</div>
|
|
7
|
-
|
|
8
|
-
<div class="col-12 p-0">
|
|
9
|
-
<div class="card p-0 document-list-wrapper">
|
|
10
|
-
<p-accordion>
|
|
11
|
-
<p-accordionTab [selected]="true" class="line-height-2 m-0">
|
|
12
|
-
<ng-template pTemplate="header" let-active="active">
|
|
13
|
-
<div class="flex align-items-center justify-content-between w-full">
|
|
14
|
-
<span class="flex align-items-center gap-2">
|
|
15
|
-
Documents
|
|
16
|
-
</span>
|
|
17
|
-
<button pButton pRipple class="p-button-raised" type="button" label="Upload File"
|
|
18
|
-
style="border-radius: 10px;" (click)="handleFileUploadClick($event)"></button>
|
|
19
|
-
</div>
|
|
20
|
-
</ng-template>
|
|
21
|
-
@for(document of documentList; track document){
|
|
22
|
-
<lib-document-list-item [document]="document"
|
|
23
|
-
(documentClick)="handleClickForDocument($event)"></lib-document-list-item>
|
|
24
|
-
}
|
|
25
|
-
</p-accordionTab>
|
|
26
|
-
</p-accordion>
|
|
27
|
-
</div>
|
|
28
|
-
</div>
|
|
29
|
-
<div class="grid">
|
|
30
|
-
<div class="col-12">
|
|
31
|
-
<p-sidebar [(visible)]="isSidebarVisible" position="right" [styleClass]="'right-sidebar'">
|
|
32
|
-
<lib-document-upload [contextId]="contextId"></lib-document-upload>
|
|
33
|
-
</p-sidebar>
|
|
34
|
-
</div>
|
|
1
|
+
<div class="document-viewer">
|
|
2
|
+
<p-dialog [(visible)]="isdialogVisible" [modal]="true" (onHide)="handleCloseModel()" [style]="{ width: '100vw' }"
|
|
3
|
+
[draggable]="false" [closable]="true">
|
|
4
|
+
<document-viewer [selectedDocument]="selectedDocument"></document-viewer>
|
|
5
|
+
</p-dialog>
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<div class="col-12 p-0">
|
|
9
|
+
<div class="card p-0 document-list-wrapper">
|
|
10
|
+
<p-accordion>
|
|
11
|
+
<p-accordionTab [selected]="true" class="line-height-2 m-0">
|
|
12
|
+
<ng-template pTemplate="header" let-active="active">
|
|
13
|
+
<div class="flex align-items-center justify-content-between w-full">
|
|
14
|
+
<span class="flex align-items-center gap-2">
|
|
15
|
+
Documents
|
|
16
|
+
</span>
|
|
17
|
+
<button pButton pRipple class="p-button-raised" type="button" label="Upload File"
|
|
18
|
+
style="border-radius: 10px;" (click)="handleFileUploadClick($event)"></button>
|
|
19
|
+
</div>
|
|
20
|
+
</ng-template>
|
|
21
|
+
@for(document of documentList; track document){
|
|
22
|
+
<lib-document-list-item [document]="document"
|
|
23
|
+
(documentClick)="handleClickForDocument($event)"></lib-document-list-item>
|
|
24
|
+
}
|
|
25
|
+
</p-accordionTab>
|
|
26
|
+
</p-accordion>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="grid">
|
|
30
|
+
<div class="col-12">
|
|
31
|
+
<p-sidebar [(visible)]="isSidebarVisible" position="right" [styleClass]="'right-sidebar'">
|
|
32
|
+
<lib-document-upload [contextId]="contextId"></lib-document-upload>
|
|
33
|
+
</p-sidebar>
|
|
34
|
+
</div>
|
|
35
35
|
</div>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
.document-list-wrapper{
|
|
2
|
-
.p-accordion-header-link {
|
|
3
|
-
padding: 0.5rem;
|
|
4
|
-
}
|
|
5
|
-
.p-sidebar-right{
|
|
6
|
-
width: 35%;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.right-sidebar{
|
|
11
|
-
width: 35%;
|
|
1
|
+
.document-list-wrapper{
|
|
2
|
+
.p-accordion-header-link {
|
|
3
|
+
padding: 0.5rem;
|
|
4
|
+
}
|
|
5
|
+
.p-sidebar-right{
|
|
6
|
+
width: 35%;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.right-sidebar{
|
|
11
|
+
width: 35%;
|
|
12
12
|
}
|
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
import { Component, Input, ViewEncapsulation } from '@angular/core';
|
|
2
|
-
import { DocumentModel } from '../../models/document.model';
|
|
3
|
-
import { SHARED } from '../../../../Shared/constant/SHARED';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* This component is responsible for displaying a list of documents.
|
|
8
|
-
* @class DocumentListComponent
|
|
9
|
-
* @typedef {DocumentListComponent}
|
|
10
|
-
*/
|
|
11
|
-
@Component({
|
|
12
|
-
selector: 'lib-document-list',
|
|
13
|
-
standalone: false,
|
|
14
|
-
templateUrl: './document-list.component.html',
|
|
15
|
-
styleUrls: ['./document-list.component.scss'],
|
|
16
|
-
encapsulation: ViewEncapsulation.None
|
|
17
|
-
})
|
|
18
|
-
export class DocumentListComponent {
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Represent contextId
|
|
22
|
-
* @type {string}
|
|
23
|
-
*/
|
|
24
|
-
@Input() contextId : string = SHARED.EMPTY
|
|
25
|
-
|
|
26
|
-
selectedDocument !: DocumentModel
|
|
27
|
-
/**
|
|
28
|
-
* Default visbility of sidebar
|
|
29
|
-
* @type {boolean}
|
|
30
|
-
*/
|
|
31
|
-
isSidebarVisible: boolean = SHARED.FALSE
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Default visbility of dialog
|
|
35
|
-
* @type {boolean}
|
|
36
|
-
*/
|
|
37
|
-
isdialogVisible: boolean = SHARED.FALSE
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* The list of documents to display.
|
|
41
|
-
* @type {DocumentModel[]}
|
|
42
|
-
*/
|
|
43
|
-
@Input() documentList: DocumentModel[] = [];
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Handles the click event for file upload.
|
|
48
|
-
* Prevents event propagation and displays the sidebar.
|
|
49
|
-
* @param {MouseEvent} event - The click event triggered by the user.
|
|
50
|
-
*/
|
|
51
|
-
handleFileUploadClick(event: MouseEvent): void {
|
|
52
|
-
event.stopPropagation();
|
|
53
|
-
this.isSidebarVisible = SHARED.TRUE;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Select a individual document.
|
|
59
|
-
* @param {*} docuemnt - The document that was clicked by the user.
|
|
60
|
-
*/
|
|
61
|
-
handleClickForDocument(docuemnt: DocumentModel) {
|
|
62
|
-
this.isdialogVisible = SHARED.TRUE
|
|
63
|
-
this.selectedDocument = docuemnt
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Close dialog.
|
|
68
|
-
*/
|
|
69
|
-
handleCloseModel(){
|
|
70
|
-
this.selectedDocument = {_id : SHARED.INITIAL_VALUE};
|
|
71
|
-
this.isdialogVisible = SHARED.FALSE
|
|
72
|
-
}
|
|
73
|
-
}
|
|
1
|
+
import { Component, Input, ViewEncapsulation } from '@angular/core';
|
|
2
|
+
import { DocumentModel } from '../../models/document.model';
|
|
3
|
+
import { SHARED } from '../../../../Shared/constant/SHARED';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* This component is responsible for displaying a list of documents.
|
|
8
|
+
* @class DocumentListComponent
|
|
9
|
+
* @typedef {DocumentListComponent}
|
|
10
|
+
*/
|
|
11
|
+
@Component({
|
|
12
|
+
selector: 'lib-document-list',
|
|
13
|
+
standalone: false,
|
|
14
|
+
templateUrl: './document-list.component.html',
|
|
15
|
+
styleUrls: ['./document-list.component.scss'],
|
|
16
|
+
encapsulation: ViewEncapsulation.None
|
|
17
|
+
})
|
|
18
|
+
export class DocumentListComponent {
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Represent contextId
|
|
22
|
+
* @type {string}
|
|
23
|
+
*/
|
|
24
|
+
@Input() contextId : string = SHARED.EMPTY
|
|
25
|
+
|
|
26
|
+
selectedDocument !: DocumentModel
|
|
27
|
+
/**
|
|
28
|
+
* Default visbility of sidebar
|
|
29
|
+
* @type {boolean}
|
|
30
|
+
*/
|
|
31
|
+
isSidebarVisible: boolean = SHARED.FALSE
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Default visbility of dialog
|
|
35
|
+
* @type {boolean}
|
|
36
|
+
*/
|
|
37
|
+
isdialogVisible: boolean = SHARED.FALSE
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The list of documents to display.
|
|
41
|
+
* @type {DocumentModel[]}
|
|
42
|
+
*/
|
|
43
|
+
@Input() documentList: DocumentModel[] = [];
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Handles the click event for file upload.
|
|
48
|
+
* Prevents event propagation and displays the sidebar.
|
|
49
|
+
* @param {MouseEvent} event - The click event triggered by the user.
|
|
50
|
+
*/
|
|
51
|
+
handleFileUploadClick(event: MouseEvent): void {
|
|
52
|
+
event.stopPropagation();
|
|
53
|
+
this.isSidebarVisible = SHARED.TRUE;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Select a individual document.
|
|
59
|
+
* @param {*} docuemnt - The document that was clicked by the user.
|
|
60
|
+
*/
|
|
61
|
+
handleClickForDocument(docuemnt: DocumentModel) {
|
|
62
|
+
this.isdialogVisible = SHARED.TRUE
|
|
63
|
+
this.selectedDocument = docuemnt
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Close dialog.
|
|
68
|
+
*/
|
|
69
|
+
handleCloseModel(){
|
|
70
|
+
this.selectedDocument = {_id : SHARED.INITIAL_VALUE};
|
|
71
|
+
this.isdialogVisible = SHARED.FALSE
|
|
72
|
+
}
|
|
73
|
+
}
|