cat-documents-ng 0.1.30 → 0.1.32
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/{src/Shared/constant/ERROR.ts → Shared/constant/ERROR.d.ts} +43 -38
- package/Shared/constant/PERMISSIONS.d.ts +20 -0
- package/Shared/constant/SHARED.d.ts +215 -0
- package/{src/Shared/constant/URLS.ts → Shared/constant/URLS.d.ts} +60 -65
- package/Shared/services/app-config.service.d.ts +51 -0
- package/{src/Shared/services/global-error.handler.ts → Shared/services/global-error.handler.d.ts} +27 -29
- package/Shared/services/session.service.d.ts +46 -0
- package/fesm2022/cat-documents-ng.mjs +2623 -0
- package/fesm2022/cat-documents-ng.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/document/components/document-container/document-container.component.d.ts +101 -0
- package/lib/document/components/document-list/document-list.component.d.ts +193 -0
- package/lib/document/components/document-list-item/document-list-item.component.d.ts +28 -0
- package/lib/document/components/document-upload/document-upload.component.d.ts +120 -0
- package/lib/document/components/document-viewer/document-viewer.component.d.ts +77 -0
- package/{src/lib/document/components/folder-block/folder-block.component.ts → lib/document/components/folder-block/folder-block.component.d.ts} +37 -53
- package/lib/document/components/folder-container/folder-container.component.d.ts +29 -0
- package/lib/document/components/linked-document/linked-document.component.d.ts +38 -0
- package/lib/document/directives/document.directive.d.ts +20 -0
- package/lib/document/directives/permission.directive.d.ts +38 -0
- package/lib/document/document.module.d.ts +40 -0
- package/{src/lib/document/models/document-alert.model.ts → lib/document/models/document-alert.model.d.ts} +38 -45
- package/lib/document/models/document-type.model.d.ts +37 -0
- package/lib/document/models/document.model.d.ts +44 -0
- package/{src/lib/document/models/folder.model.ts → lib/document/models/folder.model.d.ts} +29 -35
- package/lib/document/services/document-http.service.d.ts +69 -0
- package/lib/document/services/document-upload.service.d.ts +67 -0
- package/lib/document/services/document.service.d.ts +20 -0
- package/lib/document/services/file-format.service.d.ts +23 -0
- package/lib/document/state/document.query.d.ts +50 -0
- package/{src/lib/document/state/document.service.ts → lib/document/state/document.service.d.ts} +64 -95
- package/{src/lib/document/state/document.state.ts → lib/document/state/document.state.d.ts} +36 -52
- package/lib/document/state/document.store.d.ts +29 -0
- package/package.json +25 -20
- package/{src/public-api.ts → public-api.d.ts} +6 -10
- package/ng-package.json +0 -11
- package/src/Shared/constant/PERMISSIONS.ts +0 -16
- package/src/Shared/constant/SHARED.ts +0 -312
- package/src/Shared/services/app-config.service.spec.ts +0 -19
- package/src/Shared/services/app-config.service.ts +0 -73
- package/src/Shared/services/session.service.spec.ts +0 -16
- package/src/Shared/services/session.service.ts +0 -76
- package/src/assets/config/api.config.json +0 -20
- package/src/lib/document/components/document-container/document-container.component.html +0 -14
- package/src/lib/document/components/document-container/document-container.component.scss +0 -8
- package/src/lib/document/components/document-container/document-container.component.spec.ts +0 -110
- package/src/lib/document/components/document-container/document-container.component.ts +0 -173
- package/src/lib/document/components/document-list/document-list.component.html +0 -81
- package/src/lib/document/components/document-list/document-list.component.scss +0 -82
- package/src/lib/document/components/document-list/document-list.component.spec.ts +0 -96
- package/src/lib/document/components/document-list/document-list.component.ts +0 -244
- package/src/lib/document/components/document-list-item/document-list-item.component.html +0 -36
- package/src/lib/document/components/document-list-item/document-list-item.component.scss +0 -34
- package/src/lib/document/components/document-list-item/document-list-item.component.spec.ts +0 -75
- package/src/lib/document/components/document-list-item/document-list-item.component.ts +0 -40
- package/src/lib/document/components/document-upload/document-upload.component.html +0 -56
- package/src/lib/document/components/document-upload/document-upload.component.scss +0 -32
- package/src/lib/document/components/document-upload/document-upload.component.spec.ts +0 -95
- package/src/lib/document/components/document-upload/document-upload.component.ts +0 -162
- package/src/lib/document/components/document-viewer/document-viewer.component.html +0 -98
- package/src/lib/document/components/document-viewer/document-viewer.component.scss +0 -54
- package/src/lib/document/components/document-viewer/document-viewer.component.spec.ts +0 -79
- package/src/lib/document/components/document-viewer/document-viewer.component.ts +0 -106
- package/src/lib/document/components/folder-block/folder-block.component.html +0 -46
- package/src/lib/document/components/folder-block/folder-block.component.scss +0 -9
- package/src/lib/document/components/folder-block/folder-block.component.spec.ts +0 -70
- package/src/lib/document/components/folder-container/folder-container.component.html +0 -2
- package/src/lib/document/components/folder-container/folder-container.component.scss +0 -0
- package/src/lib/document/components/folder-container/folder-container.component.spec.ts +0 -27
- package/src/lib/document/components/folder-container/folder-container.component.ts +0 -37
- package/src/lib/document/components/linked-document/linked-document.component.html +0 -23
- package/src/lib/document/components/linked-document/linked-document.component.scss +0 -10
- package/src/lib/document/components/linked-document/linked-document.component.spec.ts +0 -61
- package/src/lib/document/components/linked-document/linked-document.component.ts +0 -49
- package/src/lib/document/directives/document.directive.ts +0 -32
- package/src/lib/document/directives/permission.directive.spec.ts +0 -0
- package/src/lib/document/directives/permission.directive.ts +0 -66
- package/src/lib/document/document.module.ts +0 -241
- package/src/lib/document/models/document-type.model.ts +0 -44
- package/src/lib/document/models/document.model.ts +0 -53
- package/src/lib/document/services/document-http.service.spec.ts +0 -119
- package/src/lib/document/services/document-http.service.ts +0 -125
- package/src/lib/document/services/document-upload.service.spec.ts +0 -99
- package/src/lib/document/services/document-upload.service.ts +0 -127
- package/src/lib/document/services/document.service.ts +0 -29
- package/src/lib/document/services/file-format.service.spec.ts +0 -16
- package/src/lib/document/services/file-format.service.ts +0 -41
- package/src/lib/document/state/document.query.ts +0 -52
- package/src/lib/document/state/document.store.ts +0 -51
- package/tsconfig.lib.json +0 -15
- package/tsconfig.lib.prod.json +0 -11
- package/tsconfig.spec.json +0 -15
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { fakeAsync, TestBed, tick } from '@angular/core/testing';
|
|
2
|
-
import { DocumentUploadService } from './document-upload.service';
|
|
3
|
-
import { DocumentService } from '../state/document.service';
|
|
4
|
-
import { DocumentStore } from '../state/document.store';
|
|
5
|
-
import { MessageService } from 'primeng/api';
|
|
6
|
-
import { of, throwError } from 'rxjs';
|
|
7
|
-
import { SHARED } from '../../../Shared/constant/SHARED';
|
|
8
|
-
|
|
9
|
-
describe('DocumentUploadService', () => {
|
|
10
|
-
let service: DocumentUploadService;
|
|
11
|
-
let mockDocumentService: jasmine.SpyObj<DocumentService>;
|
|
12
|
-
let mockDocumentStore: jasmine.SpyObj<DocumentStore>;
|
|
13
|
-
let mockMessageService: jasmine.SpyObj<MessageService>;
|
|
14
|
-
|
|
15
|
-
beforeEach(() => {
|
|
16
|
-
mockDocumentService = jasmine.createSpyObj('DocumentService', ['create']);
|
|
17
|
-
mockDocumentStore = jasmine.createSpyObj('DocumentStore', ['setUploadedDocumentFiles', 'setMessage']);
|
|
18
|
-
mockMessageService = jasmine.createSpyObj('MessageService', ['add']);
|
|
19
|
-
|
|
20
|
-
TestBed.configureTestingModule({
|
|
21
|
-
providers: [
|
|
22
|
-
DocumentUploadService,
|
|
23
|
-
{ provide: DocumentService, useValue: mockDocumentService },
|
|
24
|
-
{ provide: DocumentStore, useValue: mockDocumentStore },
|
|
25
|
-
{ provide: MessageService, useValue: mockMessageService }
|
|
26
|
-
]
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
service = TestBed.inject(DocumentUploadService);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('should be created', () => {
|
|
33
|
-
expect(service).toBeTruthy();
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('should set uploadedFile, contextId, docName, and docTypeId when getUploadFileData is called', () => {
|
|
37
|
-
const mockFile = new File(['test content'], 'test.pdf', { type: 'application/pdf' });
|
|
38
|
-
const contextId = '1234';
|
|
39
|
-
|
|
40
|
-
service.getUploadFileData(mockFile, contextId);
|
|
41
|
-
|
|
42
|
-
expect(service.uploadedFile).toBe(mockFile);
|
|
43
|
-
expect(service.contextId).toBe(contextId);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('should set document name and type when getDocumentNameAndType is called', () => {
|
|
47
|
-
const documentName = 'Test Document';
|
|
48
|
-
const documentTypeId = '5678';
|
|
49
|
-
|
|
50
|
-
service.getDocumentNameAndType(documentTypeId);
|
|
51
|
-
|
|
52
|
-
expect(service.docName).toBe(SHARED.EMPTY);
|
|
53
|
-
expect(service.docTypeId).toBe(documentTypeId);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
it('should handle null formData in handleTemplatedUpload', () => {
|
|
59
|
-
const mockFile = new File(['test content'], 'test.pdf', { type: 'application/pdf' });
|
|
60
|
-
const contextId = '1234';
|
|
61
|
-
const documentName = 'Test Document';
|
|
62
|
-
const documentTypeId = '5678';
|
|
63
|
-
service.getUploadFileData(mockFile, contextId);
|
|
64
|
-
service.getDocumentNameAndType(documentTypeId);
|
|
65
|
-
spyOn(service, 'handleCreateFormData').and.returnValue(null);
|
|
66
|
-
service.handleTemplatedUpload();
|
|
67
|
-
expect(mockMessageService.add).toHaveBeenCalledWith({
|
|
68
|
-
severity: 'error',
|
|
69
|
-
summary: 'Form Data Missing',
|
|
70
|
-
detail: 'Required form data is missing. Please ensure the document and all required fields are provided.'
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
it('should return null from handleCreateFormData if data is incomplete', () => {
|
|
76
|
-
const formData = service.handleCreateFormData();
|
|
77
|
-
expect(formData).toBeNull();
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('should call documentService.create and set uploaded files when handleTemplatedUpload is called', () => {
|
|
81
|
-
const mockFile = new File(['test content'], 'test.pdf', { type: 'application/pdf' });
|
|
82
|
-
const contextId = '1234';
|
|
83
|
-
const documentName = 'Test Document';
|
|
84
|
-
const documentTypeId = '5678';
|
|
85
|
-
const formData = new FormData();
|
|
86
|
-
formData.append(SHARED.FILE, mockFile);
|
|
87
|
-
|
|
88
|
-
service.getUploadFileData(mockFile, contextId);
|
|
89
|
-
service.getDocumentNameAndType(documentTypeId);
|
|
90
|
-
|
|
91
|
-
mockDocumentService.create.and.returnValue(of({ fileId: 'abcd1234' }));
|
|
92
|
-
|
|
93
|
-
service.handleTemplatedUpload();
|
|
94
|
-
|
|
95
|
-
expect(mockDocumentService.create).toHaveBeenCalledWith(formData);
|
|
96
|
-
expect(mockDocumentStore.setUploadedDocumentFiles).toHaveBeenCalled();
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
});
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { SHARED } from '../../../Shared/constant/SHARED';
|
|
3
|
-
import { DocumentService } from '../state/document.service';
|
|
4
|
-
import { DocumentStore } from '../state/document.store';
|
|
5
|
-
import { MessageService } from 'primeng/api';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Service for handling document uploads.
|
|
9
|
-
* @class DocumentUploadService
|
|
10
|
-
* @typedef {DocumentUploadService}
|
|
11
|
-
*/
|
|
12
|
-
@Injectable({
|
|
13
|
-
providedIn: 'root'
|
|
14
|
-
})
|
|
15
|
-
export class DocumentUploadService {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* The file to upload.
|
|
20
|
-
* @type {*}
|
|
21
|
-
*/
|
|
22
|
-
uploadedFile: any;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Represent contextId
|
|
26
|
-
* @type {string}
|
|
27
|
-
*/
|
|
28
|
-
contextId: string = SHARED.EMPTY
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Represent document name
|
|
33
|
-
* @type {string}
|
|
34
|
-
*/
|
|
35
|
-
docName: string = SHARED.EMPTY
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Represent document id
|
|
39
|
-
* @type {string}
|
|
40
|
-
*/
|
|
41
|
-
docTypeId: string = SHARED.EMPTY
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Creates an instance of DocumentUploadService.
|
|
45
|
-
* @param {DocumentService} documentService - Service for handling document uploads.
|
|
46
|
-
* @param {DocumentStore} documentUploadStore - Store for managing uploaded documents.
|
|
47
|
-
* @param {MessageService} messageService - Service for displaying messages.
|
|
48
|
-
* @returns {void}
|
|
49
|
-
*/
|
|
50
|
-
constructor(public documentService: DocumentService, public documentUploadStore: DocumentStore, public messageService: MessageService) { }
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Prepares the files for upload by creating a FormData object.
|
|
54
|
-
* This method appends each file to the FormData for submission.
|
|
55
|
-
* @returns {void}
|
|
56
|
-
*/
|
|
57
|
-
handleTemplatedUpload() {
|
|
58
|
-
let formsData = this.handleCreateFormData()
|
|
59
|
-
if (!formsData) {
|
|
60
|
-
this.messageService.add({severity: SHARED.SEVERITY,summary: SHARED.UPLOAD_ERROR_SUMMERY,detail: SHARED.UPLOAD_ERROR_DETAILS});
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
this.documentService.create(formsData)
|
|
64
|
-
.subscribe({
|
|
65
|
-
/**
|
|
66
|
-
* Handles the successful upload event.
|
|
67
|
-
* Updates the list of uploaded files and emits the file ID.
|
|
68
|
-
* @param {any} event - The event emitted by the upload service on success.
|
|
69
|
-
*/
|
|
70
|
-
next: (event) => {
|
|
71
|
-
this.documentUploadStore.setUploadedDocumentFiles(event)
|
|
72
|
-
this.documentUploadStore.setMessage([{
|
|
73
|
-
severity: SHARED.SUCCESS_SEVERITY,
|
|
74
|
-
detail : SHARED.UPLOAD_SUCCESS
|
|
75
|
-
}]);
|
|
76
|
-
},
|
|
77
|
-
/**
|
|
78
|
-
* Handles the error event during file upload.
|
|
79
|
-
* Updates the progress of the file to indicate failure.
|
|
80
|
-
* @param {any} error - The error object returned by the upload service.
|
|
81
|
-
*/
|
|
82
|
-
error: (error) => {
|
|
83
|
-
this.documentUploadStore.setMessage([{severity: SHARED.SEVERITY,summary: SHARED.UPLOAD_SUMMERY,detail: error?.message}]);
|
|
84
|
-
},
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Get the file and contextId
|
|
90
|
-
* @param file - The file to upload.
|
|
91
|
-
* @param contextId - The contextId to upload.
|
|
92
|
-
*/
|
|
93
|
-
getUploadFileData(file: File, contextId: string) {
|
|
94
|
-
if (file && contextId) {
|
|
95
|
-
this.uploadedFile = file;
|
|
96
|
-
this.contextId = contextId
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Get the document name and document type id
|
|
102
|
-
* @param documentName - The document name to upload.
|
|
103
|
-
* @param documentTypeId - The document type id to upload.
|
|
104
|
-
*/
|
|
105
|
-
getDocumentNameAndType(documentTypeId: string) {
|
|
106
|
-
if (documentTypeId) {
|
|
107
|
-
this.docTypeId = documentTypeId
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Handle the creation of formdata.
|
|
113
|
-
* @returns {*} - The formdata object.
|
|
114
|
-
*/
|
|
115
|
-
handleCreateFormData() {
|
|
116
|
-
if (this.uploadedFile && this.contextId && this.docTypeId) {
|
|
117
|
-
let formData = new FormData();
|
|
118
|
-
formData.append(SHARED.FILE, this.uploadedFile, this.uploadedFile.name);
|
|
119
|
-
formData.append(SHARED.CONTEXT_ID, this.contextId)
|
|
120
|
-
formData.append(SHARED.DOCUMENT_TYPE_ID, this.docTypeId)
|
|
121
|
-
return formData;
|
|
122
|
-
}else{
|
|
123
|
-
return null;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Injectable } from "@angular/core";
|
|
2
|
-
import { BehaviorSubject } from "rxjs";
|
|
3
|
-
import { DocumentModel } from "../models/document.model";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Service to manage the document data
|
|
7
|
-
*/
|
|
8
|
-
@Injectable({
|
|
9
|
-
providedIn: 'root',
|
|
10
|
-
})
|
|
11
|
-
export class DocumentService {
|
|
12
|
-
private documentSubject$ = new BehaviorSubject<DocumentModel | null>(null);
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Set the document data
|
|
16
|
-
* @param document the document data
|
|
17
|
-
*/
|
|
18
|
-
set(document: DocumentModel | null) {
|
|
19
|
-
this.documentSubject$.next(document);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Get the document data
|
|
24
|
-
* @returns the document data
|
|
25
|
-
*/
|
|
26
|
-
get() {
|
|
27
|
-
return this.documentSubject$.asObservable();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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,52 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { QueryEntity } from '@datorama/akita';
|
|
3
|
-
import { DocumentStore } from './document.store';
|
|
4
|
-
import { DocumentState } from './document.state';
|
|
5
|
-
import { Observable } from 'rxjs';
|
|
6
|
-
import { Message } from 'primeng/api';
|
|
7
|
-
import { DocumentModel } from '../models/document.model';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Query service for managing document state.
|
|
12
|
-
* This class extends Akita's `QueryEntity` to provide additional functionality for querying document data.
|
|
13
|
-
* @class DocumentQuery
|
|
14
|
-
* @typedef {DocumentQuery}
|
|
15
|
-
* @augments {QueryEntity<DocumentState>}
|
|
16
|
-
*/
|
|
17
|
-
@Injectable({ providedIn: 'root' })
|
|
18
|
-
export class DocumentQuery extends QueryEntity<DocumentState> {
|
|
19
|
-
constructor(protected override store: DocumentStore) {
|
|
20
|
-
super(store);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Selects the currently selected folder ID from the document state.
|
|
25
|
-
* @returns {Observable<string | null>} Observable that emits the currently selected folder ID.
|
|
26
|
-
*/
|
|
27
|
-
getParentDocumentTypeId() : string | null {
|
|
28
|
-
return this.getValue()['parentDocumentTypeId'];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Selects the currently selected folder ID from the document state.
|
|
33
|
-
* @returns {Observable<string | null>} Observable that emits the currently selected folder ID.
|
|
34
|
-
*/
|
|
35
|
-
selectParentDocumentTypeId():Observable<string | null> {
|
|
36
|
-
return this.select((state) => state['parentDocumentTypeId']);
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Selects the set messages.
|
|
40
|
-
* @returns {Observable<Message>} Observable that emits the current Message.
|
|
41
|
-
*/
|
|
42
|
-
selectMessages():Observable<Message[]> {
|
|
43
|
-
return this.select((state) => state.messages);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Selects the set documents.
|
|
47
|
-
* @returns {Observable<DocumentModel[]>} Observable that emits the documets.
|
|
48
|
-
*/
|
|
49
|
-
selectDocumets():Observable<DocumentModel[]> {
|
|
50
|
-
return this.select((state) => state.documentList);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { EntityStore, StoreConfig } from '@datorama/akita';
|
|
3
|
-
import { createInitialState, DocumentState } from './document.state';
|
|
4
|
-
import { DocumentTypeModel } from '../models/document-type.model';
|
|
5
|
-
import { Message } from 'primeng/api';
|
|
6
|
-
import { DocumentModel } from '../models/document.model';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Store that manages the state of documents in the application.
|
|
10
|
-
* The `DocumentStore` class extends Akita's `EntityStore` to manage the entity state for documents.
|
|
11
|
-
* It uses the `createInitialState` function to initialize the store with default values and
|
|
12
|
-
* is configured with the name `'documents'`.
|
|
13
|
-
* @augments EntityStore<DocumentState>
|
|
14
|
-
*/
|
|
15
|
-
@Injectable({ providedIn: 'root' })
|
|
16
|
-
@StoreConfig({ name: 'documents' })
|
|
17
|
-
export class DocumentStore extends EntityStore<DocumentState> {
|
|
18
|
-
/**
|
|
19
|
-
* Creates an instance of `DocumentStore` with the initial state of the documents.
|
|
20
|
-
*/
|
|
21
|
-
constructor() {
|
|
22
|
-
super(createInitialState());
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
setUploadedDocumentFiles(files: any[]) {
|
|
26
|
-
this.update({ uploadedDocumentFiles: files });
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
setFolders(folders: any) {
|
|
30
|
-
this.update({ folders: folders });
|
|
31
|
-
}
|
|
32
|
-
setDocumentTypes(documentType: any) {
|
|
33
|
-
this.update({ uploadedDocumentFiles: documentType });
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
setDocumentAlert(documentAlert: any) {
|
|
37
|
-
this.update({ documentAlert : documentAlert });
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
setParentDocumentTypeId(parentDocumentTypeId: string) {
|
|
41
|
-
this.update({ parentDocumentTypeId });
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
setMessage(message: Message[]) {
|
|
45
|
-
this.update({ messages : message });
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
setDocumentList(documents: DocumentModel[]) {
|
|
49
|
-
this.update({ documents : documents });
|
|
50
|
-
}
|
|
51
|
-
}
|
package/tsconfig.lib.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
-
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
3
|
-
{
|
|
4
|
-
"extends": "../../tsconfig.json",
|
|
5
|
-
"compilerOptions": {
|
|
6
|
-
"outDir": "../../out-tsc/lib",
|
|
7
|
-
"declaration": true,
|
|
8
|
-
"declarationMap": true,
|
|
9
|
-
"inlineSources": true,
|
|
10
|
-
"types": []
|
|
11
|
-
},
|
|
12
|
-
"exclude": [
|
|
13
|
-
"**/*.spec.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|
package/tsconfig.lib.prod.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
-
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
3
|
-
{
|
|
4
|
-
"extends": "./tsconfig.lib.json",
|
|
5
|
-
"compilerOptions": {
|
|
6
|
-
"declarationMap": false
|
|
7
|
-
},
|
|
8
|
-
"angularCompilerOptions": {
|
|
9
|
-
"compilationMode": "partial"
|
|
10
|
-
}
|
|
11
|
-
}
|
package/tsconfig.spec.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
|
2
|
-
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
|
3
|
-
{
|
|
4
|
-
"extends": "../../tsconfig.json",
|
|
5
|
-
"compilerOptions": {
|
|
6
|
-
"outDir": "../../out-tsc/spec",
|
|
7
|
-
"types": [
|
|
8
|
-
"jasmine"
|
|
9
|
-
]
|
|
10
|
-
},
|
|
11
|
-
"include": [
|
|
12
|
-
"**/*.spec.ts",
|
|
13
|
-
"**/*.d.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|