cat-documents-ng 0.0.10 → 0.0.12
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/README.md +19 -15
- package/Shared/constant/SHARED.d.ts +150 -0
- package/{projects/cat-document-lib/src/Shared/constant/URLS.ts → Shared/constant/URLS.d.ts} +29 -31
- package/Shared/services/app-config.service.d.ts +51 -0
- package/{projects/cat-document-lib/src/Shared/services/global-error.handler.ts → Shared/services/global-error.handler.d.ts} +27 -29
- package/fesm2022/cat-documents-ng.mjs +1411 -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 +44 -0
- package/lib/document/components/document-list/document-list.component.d.ts +47 -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 +113 -0
- package/lib/document/components/document-viewer/document-viewer.component.d.ts +113 -0
- package/{projects/cat-document-lib/src/lib/document/components/folder-block/folder-block.component.ts → lib/document/components/folder-block/folder-block.component.d.ts} +37 -51
- package/lib/document/components/folder-container/folder-container.component.d.ts +28 -0
- package/lib/document/document.module.d.ts +35 -0
- package/lib/document/models/document.model.d.ts +33 -0
- package/{projects/cat-document-lib/src/lib/document/models/folder.model.ts → lib/document/models/folder.model.d.ts} +29 -35
- package/lib/document/services/file-format.service.d.ts +23 -0
- package/{projects/cat-document-lib/src/lib/document/state/document.service.ts → lib/document/state/document.service.d.ts} +64 -95
- package/{projects/cat-document-lib/src/lib/document/state/document.state.ts → lib/document/state/document.state.d.ts} +30 -39
- package/lib/document/state/document.store.d.ts +20 -0
- package/package.json +25 -66
- package/{projects/cat-document-lib/src/public-api.ts → public-api.d.ts} +3 -8
- package/src/assets/config/app.config.json +4 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -32
- package/.github/workflows/pr-validation.yml +0 -87
- package/.husky/pre-commit +0 -4
- package/angular.json +0 -119
- package/eslint.config.cjs +0 -148
- package/projects/cat-document-lib/README.md +0 -63
- package/projects/cat-document-lib/jest.config.mjs +0 -18
- package/projects/cat-document-lib/ng-package.json +0 -11
- package/projects/cat-document-lib/package-lock.json +0 -599
- package/projects/cat-document-lib/package.json +0 -19
- package/projects/cat-document-lib/setup-jest.ts +0 -10
- package/projects/cat-document-lib/src/Shared/constant/SHARED.ts +0 -232
- package/projects/cat-document-lib/src/Shared/services/app-config.service.spec.ts +0 -16
- package/projects/cat-document-lib/src/Shared/services/app-config.service.ts +0 -73
- package/projects/cat-document-lib/src/lib/document/components/document-container/document-container.component.html +0 -6
- 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 +0 -82
- package/projects/cat-document-lib/src/lib/document/components/document-list/document-list.component.html +0 -35
- package/projects/cat-document-lib/src/lib/document/components/document-list/document-list.component.scss +0 -12
- 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 +0 -73
- package/projects/cat-document-lib/src/lib/document/components/document-list-item/document-list-item.component.html +0 -33
- package/projects/cat-document-lib/src/lib/document/components/document-list-item/document-list-item.component.scss +0 -22
- package/projects/cat-document-lib/src/lib/document/components/document-list-item/document-list-item.component.spec.ts +0 -23
- package/projects/cat-document-lib/src/lib/document/components/document-list-item/document-list-item.component.ts +0 -40
- package/projects/cat-document-lib/src/lib/document/components/document-upload/document-upload.component.html +0 -56
- package/projects/cat-document-lib/src/lib/document/components/document-upload/document-upload.component.scss +0 -26
- package/projects/cat-document-lib/src/lib/document/components/document-upload/document-upload.component.spec.ts +0 -24
- package/projects/cat-document-lib/src/lib/document/components/document-upload/document-upload.component.ts +0 -184
- package/projects/cat-document-lib/src/lib/document/components/document-viewer/document-viewer.component.html +0 -244
- package/projects/cat-document-lib/src/lib/document/components/document-viewer/document-viewer.component.scss +0 -36
- package/projects/cat-document-lib/src/lib/document/components/document-viewer/document-viewer.component.spec.ts +0 -21
- package/projects/cat-document-lib/src/lib/document/components/document-viewer/document-viewer.component.ts +0 -125
- package/projects/cat-document-lib/src/lib/document/components/folder-block/folder-block.component.html +0 -46
- 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/projects/cat-document-lib/src/lib/document/components/folder-container/folder-container.component.html +0 -2
- 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 +0 -29
- package/projects/cat-document-lib/src/lib/document/document.module.ts +0 -191
- package/projects/cat-document-lib/src/lib/document/models/document.model.ts +0 -39
- package/projects/cat-document-lib/src/lib/document/services/file-format.service.spec.ts +0 -16
- package/projects/cat-document-lib/src/lib/document/services/file-format.service.ts +0 -41
- package/projects/cat-document-lib/src/lib/document/state/document.query.ts +0 -23
- package/projects/cat-document-lib/src/lib/document/state/document.store.ts +0 -23
- package/projects/cat-document-lib/tsconfig.lib.json +0 -15
- package/projects/cat-document-lib/tsconfig.lib.prod.json +0 -11
- package/projects/cat-document-lib/tsconfig.spec.json +0 -15
- package/public/favicon.ico +0 -0
- package/src/app/app.component.html +0 -1
- package/src/app/app.component.scss +0 -0
- package/src/app/app.component.spec.ts +0 -29
- package/src/app/app.component.ts +0 -15
- package/src/app/app.module.ts +0 -60
- package/src/app/app.routing.module.ts +0 -19
- package/src/index.html +0 -13
- package/src/main.ts +0 -5
- package/src/styles.scss +0 -39
- package/tsconfig.app.json +0 -15
- package/tsconfig.json +0 -32
- /package/{projects/cat-document-lib/src → src}/assets/images/FolderImg.png +0 -0
- /package/{projects/cat-document-lib/src → src}/assets/images/Frame.png +0 -0
- /package/{projects/cat-document-lib/src → src}/assets/images/document.png +0 -0
|
@@ -1,51 +1,37 @@
|
|
|
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
|
-
|
|
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
|
-
}
|
|
1
|
+
import { DocumentStore } from '../../state/document.store';
|
|
2
|
+
import { FolderBlockModel } from '../../models/folder.model';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* The `FolderBlockComponent` is responsible for displaying a block of folders and
|
|
6
|
+
* providing filtering functionality based on folder IDs.
|
|
7
|
+
*
|
|
8
|
+
* It uses data from the `DocumentStore` and constants from the `SHARED` configuration
|
|
9
|
+
* to display missing and pending file counts.
|
|
10
|
+
*/
|
|
11
|
+
export declare class FolderBlockComponent {
|
|
12
|
+
documentStore: DocumentStore;
|
|
13
|
+
/**
|
|
14
|
+
* Array of folder blocks data to display.
|
|
15
|
+
* Each folder is represented as a `FolderBlockModel`.
|
|
16
|
+
*/
|
|
17
|
+
folderBlocks: FolderBlockModel[];
|
|
18
|
+
/** Number of missing files, sourced from the `SHARED` constants. */
|
|
19
|
+
missingFileCount: number;
|
|
20
|
+
/** Number of pending files, sourced from the `SHARED` constants. */
|
|
21
|
+
pendingFileCount: number;
|
|
22
|
+
/**
|
|
23
|
+
* Injects the `DocumentStore` service to manage and access document-related state.
|
|
24
|
+
* @param {DocumentStore} documentStore - The state management store for documents.
|
|
25
|
+
*/
|
|
26
|
+
constructor(documentStore: DocumentStore);
|
|
27
|
+
/**
|
|
28
|
+
* Handles the click event for filtering based on the provided folder ID.
|
|
29
|
+
* This method validates the folder ID and returns it for further processing.
|
|
30
|
+
* If the folder ID is not provided, an empty string is returned.
|
|
31
|
+
* @param {string} folderBlockId - The unique identifier of the folder to filter by.
|
|
32
|
+
* @returns {string} The validated folder ID, or an empty string if the input is invalid.
|
|
33
|
+
*/
|
|
34
|
+
handleClickForFilter(folderBlockId: string): string;
|
|
35
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FolderBlockComponent, never>;
|
|
36
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<FolderBlockComponent, "lib-folder-block", never, { "folderBlocks": { "alias": "folderBlocks"; "required": false; }; }, {}, never, never, false, never>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { DocumentModel } from '../../models/document.model';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* The `FolderContainerComponent` is responsible for rendering a container
|
|
5
|
+
* that displays a list of documents and associated folder panel data.
|
|
6
|
+
*
|
|
7
|
+
* This component utilizes the `FOLDERPANEL` constant for folder panel data
|
|
8
|
+
* and accepts a document list input of type `DocumentModel`.
|
|
9
|
+
*/
|
|
10
|
+
export declare class FolderContainerComponent {
|
|
11
|
+
/**
|
|
12
|
+
* A list of documents passed as input to the component.
|
|
13
|
+
* Represents the document data to be displayed in the folder container.
|
|
14
|
+
*/
|
|
15
|
+
documentList?: DocumentModel[];
|
|
16
|
+
/**
|
|
17
|
+
* Folder blocks data, sourced from the `SHARED` constants.
|
|
18
|
+
*/
|
|
19
|
+
folderBlocks: {
|
|
20
|
+
_id: string;
|
|
21
|
+
fileCount: number;
|
|
22
|
+
text: string;
|
|
23
|
+
missingFiles: number;
|
|
24
|
+
pendingFiles: number;
|
|
25
|
+
}[];
|
|
26
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FolderContainerComponent, never>;
|
|
27
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<FolderContainerComponent, "lib-folder-container", never, { "documentList": { "alias": "documentList"; "required": false; }; }, {}, never, never, false, never>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./components/document-container/document-container.component";
|
|
3
|
+
import * as i2 from "./components/folder-container/folder-container.component";
|
|
4
|
+
import * as i3 from "./components/folder-block/folder-block.component";
|
|
5
|
+
import * as i4 from "./components/document-list/document-list.component";
|
|
6
|
+
import * as i5 from "./components/document-list-item/document-list-item.component";
|
|
7
|
+
import * as i6 from "./components/document-upload/document-upload.component";
|
|
8
|
+
import * as i7 from "./components/document-viewer/document-viewer.component";
|
|
9
|
+
import * as i8 from "@angular/common";
|
|
10
|
+
import * as i9 from "primeng/accordion";
|
|
11
|
+
import * as i10 from "@angular/common/http";
|
|
12
|
+
import * as i11 from "primeng/button";
|
|
13
|
+
import * as i12 from "primeng/sidebar";
|
|
14
|
+
import * as i13 from "primeng/fileupload";
|
|
15
|
+
import * as i14 from "primeng/progressbar";
|
|
16
|
+
import * as i15 from "primeng/badge";
|
|
17
|
+
import * as i16 from "primeng/listbox";
|
|
18
|
+
import * as i17 from "primeng/checkbox";
|
|
19
|
+
import * as i18 from "primeng/timeline";
|
|
20
|
+
import * as i19 from "primeng/inputtextarea";
|
|
21
|
+
import * as i20 from "@angular/forms";
|
|
22
|
+
import * as i21 from "ng2-pdf-viewer";
|
|
23
|
+
import * as i22 from "primeng/dialog";
|
|
24
|
+
/**
|
|
25
|
+
* @module DocumentModule
|
|
26
|
+
*
|
|
27
|
+
* The `DocumentModule` handles the organization and display of document and folder components
|
|
28
|
+
* in the application. This module is designed to support features like folder containers,
|
|
29
|
+
* document lists, and individual document items.
|
|
30
|
+
*/
|
|
31
|
+
export declare class DocumentModule {
|
|
32
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DocumentModule, never>;
|
|
33
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DocumentModule, [typeof i1.DocumentContainerComponent, typeof i2.FolderContainerComponent, typeof i3.FolderBlockComponent, typeof i4.DocumentListComponent, typeof i5.DocumentListItemComponent, typeof i6.DocumentUploadComponent, typeof i7.DocumentViewerComponent], [typeof i8.CommonModule, typeof i9.AccordionModule, typeof i10.HttpClientModule, typeof i11.ButtonModule, typeof i12.SidebarModule, typeof i13.FileUploadModule, typeof i14.ProgressBarModule, typeof i15.BadgeModule, typeof i16.ListboxModule, typeof i17.CheckboxModule, typeof i18.TimelineModule, typeof i19.InputTextareaModule, typeof i20.FormsModule, typeof i21.PdfViewerModule, typeof i22.DialogModule], [typeof i1.DocumentContainerComponent, typeof i7.DocumentViewerComponent]>;
|
|
34
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<DocumentModule>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a document model.
|
|
3
|
+
*
|
|
4
|
+
* This class contains the structure for document-related data, including file name,
|
|
5
|
+
* status, and document URL.
|
|
6
|
+
*/
|
|
7
|
+
export declare class DocumentModel {
|
|
8
|
+
/**
|
|
9
|
+
* The unique identifier for the document.
|
|
10
|
+
* @type {number}
|
|
11
|
+
*/
|
|
12
|
+
_id: number;
|
|
13
|
+
/**
|
|
14
|
+
* The name of the document file.
|
|
15
|
+
* @type {?string}
|
|
16
|
+
*/
|
|
17
|
+
fileName?: string;
|
|
18
|
+
/**
|
|
19
|
+
* The current status of the document.
|
|
20
|
+
* @type {?string}
|
|
21
|
+
*/
|
|
22
|
+
status?: string;
|
|
23
|
+
/**
|
|
24
|
+
* The URL where the document is hosted or stored.
|
|
25
|
+
* @type {?string}
|
|
26
|
+
*/
|
|
27
|
+
documentUrl?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Date of document get uploaded
|
|
30
|
+
* @type {?Date}
|
|
31
|
+
*/
|
|
32
|
+
createdAt?: Date;
|
|
33
|
+
}
|
|
@@ -1,35 +1,29 @@
|
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Number of files marked as pending in the folder block.
|
|
33
|
-
*/
|
|
34
|
-
pendingFiles?: number;
|
|
35
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Represents the model for a folder block.
|
|
3
|
+
*
|
|
4
|
+
* This class provides the structure for folder block data, including properties
|
|
5
|
+
* for ID, file counts, descriptive text, and counts for missing and pending files.
|
|
6
|
+
*/
|
|
7
|
+
export declare class FolderBlockModel {
|
|
8
|
+
/**
|
|
9
|
+
* Unique identifier for the folder block.
|
|
10
|
+
* Defaults to an empty string sourced from `SHARED.EMPTY`.
|
|
11
|
+
*/
|
|
12
|
+
_id: string;
|
|
13
|
+
/**
|
|
14
|
+
* Total number of files within the folder block.
|
|
15
|
+
*/
|
|
16
|
+
fileCount?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Descriptive text associated with the folder block.
|
|
19
|
+
*/
|
|
20
|
+
text?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Number of files marked as missing in the folder block.
|
|
23
|
+
*/
|
|
24
|
+
missingFiles?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Number of files marked as pending in the folder block.
|
|
27
|
+
*/
|
|
28
|
+
pendingFiles?: number;
|
|
29
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { PrimeNGConfig } from 'primeng/api';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* Description placeholder
|
|
5
|
+
* @class FileFormatService
|
|
6
|
+
* @typedef {FileFormatService}
|
|
7
|
+
*/
|
|
8
|
+
export declare class FileFormatService {
|
|
9
|
+
/**
|
|
10
|
+
* Creates an instance of FileFormatService.
|
|
11
|
+
* @constructor
|
|
12
|
+
*/
|
|
13
|
+
constructor();
|
|
14
|
+
/**
|
|
15
|
+
* Description placeholder
|
|
16
|
+
* @param {number} bytes
|
|
17
|
+
* @param {PrimeNGConfig} config
|
|
18
|
+
* @returns {string}
|
|
19
|
+
*/
|
|
20
|
+
formatFileSize(bytes: number, config: PrimeNGConfig): string;
|
|
21
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FileFormatService, never>;
|
|
22
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<FileFormatService>;
|
|
23
|
+
}
|
|
@@ -1,95 +1,64 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*
|
|
22
|
-
* @param {
|
|
23
|
-
* @param {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
*
|
|
34
|
-
* @
|
|
35
|
-
* @
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
*
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
*
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
* @returns {Observable<any>} Observable that emits the retrieved document.
|
|
66
|
-
*/
|
|
67
|
-
getById(id: string): Observable<any> {
|
|
68
|
-
return this.http.get<any>(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}/${id}`).pipe(
|
|
69
|
-
tap((entity: any) => this.documentStore.upsert(id, entity))
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Updates an existing document by its ID.
|
|
75
|
-
* @param {string} id - The unique identifier of the document.
|
|
76
|
-
* @param {DocumentModel} entity - The updated data of the document.
|
|
77
|
-
* @returns {Observable<DocumentModel>} Observable that emits the updated document.
|
|
78
|
-
*/
|
|
79
|
-
update(id: string, entity: DocumentModel): Observable<DocumentModel> {
|
|
80
|
-
return this.http.put<DocumentModel>(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}/${id}`, entity).pipe(
|
|
81
|
-
tap((updatedEntity: DocumentModel) => this.documentStore.update(id, updatedEntity))
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Deletes a document by its ID.
|
|
87
|
-
* @param {string} id - The unique identifier of the document to be deleted.
|
|
88
|
-
* @returns {Observable<void>} Observable that completes when the document is deleted.
|
|
89
|
-
*/
|
|
90
|
-
delete(id: string): Observable<void> {
|
|
91
|
-
return this.http.delete<void>(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}/${id}`).pipe(
|
|
92
|
-
tap(() => this.documentStore.remove(id))
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
1
|
+
import { HttpClient } from '@angular/common/http';
|
|
2
|
+
import { DocumentStore } from './document.store';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { AppConfigService } from '../../../Shared/services/app-config.service';
|
|
5
|
+
import { DocumentModel } from '../models/document.model';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
/**
|
|
8
|
+
* Service for managing document-related operations.
|
|
9
|
+
* The `DocumentService` acts as a bridge between the application and the backend API for handling document-related data.
|
|
10
|
+
* It interacts with the `DocumentStore` for state management and uses `HttpClient` for making HTTP requests.
|
|
11
|
+
* Creates an instance of `DocumentService`.
|
|
12
|
+
* @param {DocumentStore} documentStore - The store that manages the state of documents.
|
|
13
|
+
* @param {HttpClient} http - The Angular HTTP client for making API requests.
|
|
14
|
+
*/
|
|
15
|
+
export declare class DocumentService {
|
|
16
|
+
documentStore: DocumentStore;
|
|
17
|
+
private http;
|
|
18
|
+
appConfigService: AppConfigService;
|
|
19
|
+
/**
|
|
20
|
+
* Creates an instance of DocumentService.
|
|
21
|
+
* @param {DocumentStore} documentStore - Store managing the state of documents.
|
|
22
|
+
* @param {HttpClient} http - Angular HTTP client for making API requests.
|
|
23
|
+
* @param {AppConfigService} appConfigService - Service for retrieving application configuration, such as API base URL.
|
|
24
|
+
*/
|
|
25
|
+
constructor(documentStore: DocumentStore, http: HttpClient, appConfigService: AppConfigService);
|
|
26
|
+
/**
|
|
27
|
+
* Get api url from appConfigService.
|
|
28
|
+
* @readonly
|
|
29
|
+
* @type {string}
|
|
30
|
+
*/
|
|
31
|
+
get apiUrl(): string;
|
|
32
|
+
/**
|
|
33
|
+
* Sends a request to create a new document.
|
|
34
|
+
* @param {*} entity - The data of the document to be created.
|
|
35
|
+
* @returns {Observable<any>} Observable that emits the newly created document.
|
|
36
|
+
*/
|
|
37
|
+
create(entity: any): Observable<any>;
|
|
38
|
+
/**
|
|
39
|
+
* Fetches all documents from the backend.
|
|
40
|
+
* @returns {Observable<DocumentModel[]>} Observable that emits an array of documents.
|
|
41
|
+
*/
|
|
42
|
+
getAll(): Observable<DocumentModel[]>;
|
|
43
|
+
/**
|
|
44
|
+
* Fetches a document by its ID.
|
|
45
|
+
* @param {string} id - The unique identifier of the document.
|
|
46
|
+
* @returns {Observable<any>} Observable that emits the retrieved document.
|
|
47
|
+
*/
|
|
48
|
+
getById(id: string): Observable<any>;
|
|
49
|
+
/**
|
|
50
|
+
* Updates an existing document by its ID.
|
|
51
|
+
* @param {string} id - The unique identifier of the document.
|
|
52
|
+
* @param {DocumentModel} entity - The updated data of the document.
|
|
53
|
+
* @returns {Observable<DocumentModel>} Observable that emits the updated document.
|
|
54
|
+
*/
|
|
55
|
+
update(id: string, entity: DocumentModel): Observable<DocumentModel>;
|
|
56
|
+
/**
|
|
57
|
+
* Deletes a document by its ID.
|
|
58
|
+
* @param {string} id - The unique identifier of the document to be deleted.
|
|
59
|
+
* @returns {Observable<void>} Observable that completes when the document is deleted.
|
|
60
|
+
*/
|
|
61
|
+
delete(id: string): Observable<void>;
|
|
62
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DocumentService, never>;
|
|
63
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DocumentService>;
|
|
64
|
+
}
|
|
@@ -1,39 +1,30 @@
|
|
|
1
|
-
import { EntityState } from '@datorama/akita';
|
|
2
|
-
import { DocumentModel } from '../models/document.model';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* @property {any[]}
|
|
13
|
-
* @property {
|
|
14
|
-
* @property {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
*/
|
|
32
|
-
export function createInitialState(): DocumentState {
|
|
33
|
-
return {
|
|
34
|
-
records: [],
|
|
35
|
-
filteredRecords: [],
|
|
36
|
-
folderId: null,
|
|
37
|
-
isDialogOpen: false,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
1
|
+
import { EntityState } from '@datorama/akita';
|
|
2
|
+
import { DocumentModel } from '../models/document.model';
|
|
3
|
+
/**
|
|
4
|
+
* Represents the state of the documents in the application.
|
|
5
|
+
*
|
|
6
|
+
* This interface extends Akita's `EntityState` to include additional properties
|
|
7
|
+
* for managing document-specific data, such as `records`, `filteredRecords` and `folderId`.
|
|
8
|
+
*
|
|
9
|
+
* @extends EntityState<DocumentModel, string>
|
|
10
|
+
*
|
|
11
|
+
* @property {any[]} records - A collection of records related to documents.
|
|
12
|
+
* @property {any[]} filteredRecords - A collection of filteredRecords related to documents.
|
|
13
|
+
* @property {string | null} folderId - The ID of the currently selected folder, or `null` if no folder is selected.
|
|
14
|
+
* @property {boolean} isDialogOpen - A flag indicating whether a dialog is open.
|
|
15
|
+
*/
|
|
16
|
+
export interface DocumentState extends EntityState<DocumentModel, string> {
|
|
17
|
+
records: DocumentModel[];
|
|
18
|
+
folderId: string | null;
|
|
19
|
+
isDialogOpen: boolean;
|
|
20
|
+
filteredRecords: DocumentModel[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Creates the initial state for the `DocumentState` store.
|
|
24
|
+
*
|
|
25
|
+
* This function provides default values for all properties in the `DocumentState` interface,
|
|
26
|
+
* ensuring the store starts with a consistent initial structure.
|
|
27
|
+
*
|
|
28
|
+
* @returns {DocumentState} The initial state of the document store.
|
|
29
|
+
*/
|
|
30
|
+
export declare function createInitialState(): DocumentState;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EntityStore } from '@datorama/akita';
|
|
2
|
+
import { DocumentState } from './document.state';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Store that manages the state of documents in the application.
|
|
6
|
+
*
|
|
7
|
+
* The `DocumentStore` class extends Akita's `EntityStore` to manage the entity state for documents.
|
|
8
|
+
* It uses the `createInitialState` function to initialize the store with default values and
|
|
9
|
+
* is configured with the name `'documents'`.
|
|
10
|
+
*
|
|
11
|
+
* @extends EntityStore<DocumentState>
|
|
12
|
+
*/
|
|
13
|
+
export declare class DocumentStore extends EntityStore<DocumentState> {
|
|
14
|
+
/**
|
|
15
|
+
* Creates an instance of `DocumentStore` with the initial state of the documents.
|
|
16
|
+
*/
|
|
17
|
+
constructor();
|
|
18
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DocumentStore, never>;
|
|
19
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DocumentStore>;
|
|
20
|
+
}
|
package/package.json
CHANGED
|
@@ -1,66 +1,25 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "cat-documents-ng",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"jsdocs": "^1.0.0",
|
|
27
|
-
"moment": "^2.30.1",
|
|
28
|
-
"ng2-pdf-viewer": "^9.1.5",
|
|
29
|
-
"primeflex": "^3.3.1",
|
|
30
|
-
"primeicons": "^7.0.0",
|
|
31
|
-
"primeng": "^17.18.10",
|
|
32
|
-
"rxjs": "~7.8.0",
|
|
33
|
-
"tslib": "^2.3.0",
|
|
34
|
-
"zone.js": "~0.15.0"
|
|
35
|
-
},
|
|
36
|
-
"devDependencies": {
|
|
37
|
-
"@angular-devkit/build-angular": "^19.0.5",
|
|
38
|
-
"@angular-eslint/eslint-plugin": "^19.0.2",
|
|
39
|
-
"@angular-eslint/eslint-plugin-template": "^19.0.2",
|
|
40
|
-
"@angular-eslint/template-parser": "^19.0.2",
|
|
41
|
-
"@angular/cli": "^19.0.5",
|
|
42
|
-
"@angular/compiler-cli": "^19.0.0",
|
|
43
|
-
"@eslint/js": "^9.17.0",
|
|
44
|
-
"@jest/globals": "^29.7.0",
|
|
45
|
-
"@types/jest": "^29.5.14",
|
|
46
|
-
"@typescript-eslint/eslint-plugin": "^8.18.0",
|
|
47
|
-
"@typescript-eslint/parser": "^8.18.0",
|
|
48
|
-
"angular-eslint": "19.0.2",
|
|
49
|
-
"eslint": "^9.17.0",
|
|
50
|
-
"eslint-plugin-jsdoc": "^50.6.1",
|
|
51
|
-
"husky": "^9.1.7",
|
|
52
|
-
"jest": "^29.7.0",
|
|
53
|
-
"jest-preset-angular": "^14.4.2",
|
|
54
|
-
"lint-staged": "^15.2.11",
|
|
55
|
-
"ng-packagr": "^19.0.0",
|
|
56
|
-
"ts-jest": "^29.2.5",
|
|
57
|
-
"typescript": "~5.6.2",
|
|
58
|
-
"typescript-eslint": "8.18.0"
|
|
59
|
-
},
|
|
60
|
-
"lint-staged": {
|
|
61
|
-
"**/*.ts": "eslint",
|
|
62
|
-
"**/*.js": "eslint --fix",
|
|
63
|
-
"**/*.html": "eslint --fix",
|
|
64
|
-
"*.js": "eslint --cache --fix"
|
|
65
|
-
}
|
|
66
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "cat-documents-ng",
|
|
3
|
+
"version": "0.0.12",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^19.0.0",
|
|
6
|
+
"@angular/core": "^19.0.0"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"tslib": "^2.3.0"
|
|
10
|
+
},
|
|
11
|
+
"typings": "index.d.ts",
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"main": "bundles/cat-document-lib.umd.js",
|
|
14
|
+
"module": "fesm2022/cat-documents-ng.mjs",
|
|
15
|
+
"es2015": "fesm2015/cat-document-lib.js",
|
|
16
|
+
"exports": {
|
|
17
|
+
"./package.json": {
|
|
18
|
+
"default": "./package.json"
|
|
19
|
+
},
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./index.d.ts",
|
|
22
|
+
"default": "./fesm2022/cat-documents-ng.mjs"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export * from './lib/document/document.module';
|
|
6
|
-
export * from './lib/document/components/document-container/document-container.component';
|
|
7
|
-
export * from './lib/document/components/document-viewer/document-viewer.component'
|
|
8
|
-
|
|
1
|
+
export * from './lib/document/document.module';
|
|
2
|
+
export * from './lib/document/components/document-container/document-container.component';
|
|
3
|
+
export * from './lib/document/components/document-viewer/document-viewer.component';
|