cat-documents-ng 1.0.0
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/.husky/pre-commit +4 -0
- package/README.md +59 -0
- package/angular.json +119 -0
- package/eslint.config.cjs +148 -0
- package/package.json +61 -0
- package/projects/cat-document-lib/README.md +63 -0
- package/projects/cat-document-lib/ng-package.json +12 -0
- package/projects/cat-document-lib/package.json +12 -0
- package/projects/cat-document-lib/setup-jest.ts +1 -0
- package/projects/cat-document-lib/src/assets/images/FolderImg.png +0 -0
- package/projects/cat-document-lib/src/assets/images/Frame.png +0 -0
- package/projects/cat-document-lib/src/lib/document/components/document-container/document-container.component.html +1 -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 +14 -0
- package/projects/cat-document-lib/src/lib/document/components/document-list/document-list.component.html +1 -0
- package/projects/cat-document-lib/src/lib/document/components/document-list/document-list.component.scss +0 -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 +14 -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/projects/cat-document-lib/src/lib/document/components/folder-block/folder-block.component.ts +51 -0
- 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 +24 -0
- package/projects/cat-document-lib/src/lib/document/models/document.model.ts +3 -0
- package/projects/cat-document-lib/src/lib/document/models/folder.model.ts +35 -0
- package/projects/cat-document-lib/src/lib/document/state/document.query.ts +23 -0
- package/projects/cat-document-lib/src/lib/document/state/document.service.ts +23 -0
- package/projects/cat-document-lib/src/lib/document/state/document.state.ts +39 -0
- package/projects/cat-document-lib/src/lib/document/state/document.store.ts +23 -0
- package/projects/cat-document-lib/src/public-api.ts +7 -0
- package/projects/cat-document-lib/src/shared/constant/SHARED.ts +93 -0
- package/projects/cat-document-lib/src/shared/services/global-error.handler.ts +29 -0
- 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 +59 -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 +5 -0
- package/tsconfig.app.json +15 -0
- package/tsconfig.json +32 -0
|
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,24 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { DocumentContainerComponent } from './components/document-container/document-container.component';
|
|
4
|
+
import { DocumentListComponent } from './components/document-list/document-list.component';
|
|
5
|
+
import { FolderBlockComponent } from './components/folder-block/folder-block.component';
|
|
6
|
+
import { FolderContainerComponent } from './components/folder-container/folder-container.component';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
@NgModule({
|
|
13
|
+
declarations: [
|
|
14
|
+
DocumentContainerComponent,
|
|
15
|
+
DocumentListComponent,
|
|
16
|
+
FolderBlockComponent,
|
|
17
|
+
FolderContainerComponent
|
|
18
|
+
],
|
|
19
|
+
imports: [
|
|
20
|
+
CommonModule,
|
|
21
|
+
],
|
|
22
|
+
exports : [DocumentContainerComponent]
|
|
23
|
+
})
|
|
24
|
+
export class DocumentModule { }
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SHARED } from "../../../Shared/constant/SHARED";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents the model for a folder block.
|
|
5
|
+
*
|
|
6
|
+
* This class provides the structure for folder block data, including properties
|
|
7
|
+
* for ID, file counts, descriptive text, and counts for missing and pending files.
|
|
8
|
+
*/
|
|
9
|
+
export class FolderBlockModel {
|
|
10
|
+
/**
|
|
11
|
+
* Unique identifier for the folder block.
|
|
12
|
+
* Defaults to an empty string sourced from `SHARED.EMPTY`.
|
|
13
|
+
*/
|
|
14
|
+
_id: string = SHARED.EMPTY;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Total number of files within the folder block.
|
|
18
|
+
*/
|
|
19
|
+
fileCount?: number;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Descriptive text associated with the folder block.
|
|
23
|
+
*/
|
|
24
|
+
text?: string;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Number of files marked as missing in the folder block.
|
|
28
|
+
*/
|
|
29
|
+
missingFiles?: number;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Number of files marked as pending in the folder block.
|
|
33
|
+
*/
|
|
34
|
+
pendingFiles?: number;
|
|
35
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Service that provides querying capabilities for the `DocumentStore`.
|
|
8
|
+
*
|
|
9
|
+
* The `DocumentQuery` class extends Akita's `QueryEntity`, allowing consumers
|
|
10
|
+
* to retrieve, observe, and filter data from the `DocumentStore` in a reactive manner.
|
|
11
|
+
*
|
|
12
|
+
* @extends QueryEntity<DocumentState>
|
|
13
|
+
* * Creates an instance of `DocumentQuery`.
|
|
14
|
+
*
|
|
15
|
+
* @param {DocumentStore} store - The underlying store that holds the document state.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
@Injectable({ providedIn: 'root' })
|
|
19
|
+
export class DocumentQuery extends QueryEntity<DocumentState> {
|
|
20
|
+
constructor(protected override store: DocumentStore) {
|
|
21
|
+
super(store);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { HttpClient } from '@angular/common/http';
|
|
3
|
+
import { DocumentStore } from './document.store';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Service for managing document-related operations.
|
|
7
|
+
*
|
|
8
|
+
* The `DocumentService` acts as a bridge between the application and the backend API for handling document-related data.
|
|
9
|
+
* It interacts with the `DocumentStore` for state management and uses `HttpClient` for making HTTP requests.
|
|
10
|
+
|
|
11
|
+
* Creates an instance of `DocumentService`.
|
|
12
|
+
*
|
|
13
|
+
* @param {DocumentStore} doumentStore - The store that manages the state of documents.
|
|
14
|
+
* @param {HttpClient} http - The Angular HTTP client for making API requests.
|
|
15
|
+
*/
|
|
16
|
+
@Injectable({ providedIn: 'root' })
|
|
17
|
+
export class DocumentService {
|
|
18
|
+
|
|
19
|
+
constructor(
|
|
20
|
+
public documentStore: DocumentStore,
|
|
21
|
+
private http: HttpClient, // Changed to private for better encapsulation
|
|
22
|
+
) { }
|
|
23
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { EntityState } from '@datorama/akita';
|
|
2
|
+
import { DocumentModel } from '../models/document.model';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents the state of the documents in the application.
|
|
6
|
+
*
|
|
7
|
+
* This interface extends Akita's `EntityState` to include additional properties
|
|
8
|
+
* for managing document-specific data, such as `records`, `filteredRecords` and `folderId`.
|
|
9
|
+
*
|
|
10
|
+
* @extends EntityState<DocumentModel, string>
|
|
11
|
+
*
|
|
12
|
+
* @property {any[]} records - A collection of records related to documents.
|
|
13
|
+
* @property {any[]} filteredRecords - A collection of filteredRecords related to documents.
|
|
14
|
+
* @property {string | null} folderId - The ID of the currently selected folder, or `null` if no folder is selected.
|
|
15
|
+
* @property {boolean} isDialogOpen - A flag indicating whether a dialog is open.
|
|
16
|
+
*/
|
|
17
|
+
export interface DocumentState extends EntityState<DocumentModel, string> {
|
|
18
|
+
records: DocumentModel[];
|
|
19
|
+
folderId: string | null;
|
|
20
|
+
isDialogOpen: boolean;
|
|
21
|
+
filteredRecords:DocumentModel[]
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Creates the initial state for the `DocumentState` store.
|
|
26
|
+
*
|
|
27
|
+
* This function provides default values for all properties in the `DocumentState` interface,
|
|
28
|
+
* ensuring the store starts with a consistent initial structure.
|
|
29
|
+
*
|
|
30
|
+
* @returns {DocumentState} The initial state of the document store.
|
|
31
|
+
*/
|
|
32
|
+
export function createInitialState(): DocumentState {
|
|
33
|
+
return {
|
|
34
|
+
records: [],
|
|
35
|
+
filteredRecords: [],
|
|
36
|
+
folderId: null,
|
|
37
|
+
isDialogOpen: false,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { EntityStore, StoreConfig } from '@datorama/akita';
|
|
3
|
+
import { createInitialState, DocumentState } from './document.state';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Store that manages the state of documents in the application.
|
|
7
|
+
*
|
|
8
|
+
* The `DocumentStore` class extends Akita's `EntityStore` to manage the entity state for documents.
|
|
9
|
+
* It uses the `createInitialState` function to initialize the store with default values and
|
|
10
|
+
* is configured with the name `'documents'`.
|
|
11
|
+
*
|
|
12
|
+
* @extends EntityStore<DocumentState>
|
|
13
|
+
*/
|
|
14
|
+
@Injectable({ providedIn: 'root' })
|
|
15
|
+
@StoreConfig({ name: 'documents' })
|
|
16
|
+
export class DocumentStore extends EntityStore<DocumentState> {
|
|
17
|
+
/**
|
|
18
|
+
* Creates an instance of `DocumentStore` with the initial state of the documents.
|
|
19
|
+
*/
|
|
20
|
+
constructor() {
|
|
21
|
+
super(createInitialState());
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `SHARED` class contains shared constants used across the application.
|
|
3
|
+
* These constants are related to document statuses and other shared data.
|
|
4
|
+
*/
|
|
5
|
+
export class SHARED {
|
|
6
|
+
/**
|
|
7
|
+
* Represents the count of missing files.
|
|
8
|
+
*/
|
|
9
|
+
static MISSINGCOUNT = 2;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Represents the count of pending files.
|
|
13
|
+
*/
|
|
14
|
+
static PENDINGCOUNT = 3;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Represents an empty string.
|
|
18
|
+
*/
|
|
19
|
+
static EMPTY = "";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* `DUMMYDOCUMENTLIST` is a mock list of document objects used for testing and development purposes.
|
|
24
|
+
* Each document includes an ID, file name, status, and document URL.
|
|
25
|
+
*/
|
|
26
|
+
export const DUMMYDOCUMENTLIST = [
|
|
27
|
+
{
|
|
28
|
+
_id: 1,
|
|
29
|
+
fileName: 'Document 1',
|
|
30
|
+
status: 'pending',
|
|
31
|
+
documentUrl: 'https://vadimdez.github.io/ng2-pdf-viewer/assets/pdf-test.pdf',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
_id: 2,
|
|
35
|
+
fileName: 'Document 2',
|
|
36
|
+
status: 'verified',
|
|
37
|
+
documentUrl: 'https://vadimdez.github.io/ng2-pdf-viewer/assets/pdf-test.pdf',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
_id: 3,
|
|
41
|
+
fileName: 'Document 3',
|
|
42
|
+
status: 'sentReminder',
|
|
43
|
+
documentUrl: 'https://vadimdez.github.io/ng2-pdf-viewer/assets/pdf-test.pdf',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
_id: 4,
|
|
47
|
+
fileName: 'Document 4',
|
|
48
|
+
status: 'pending',
|
|
49
|
+
documentUrl: 'https://vadimdez.github.io/ng2-pdf-viewer/assets/pdf-test.pdf',
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* `FOLDERPANEL` is a mock list of folder data representing various folders in the application.
|
|
55
|
+
* Each folder contains an ID, file count, text description, missing files count, and pending files count.
|
|
56
|
+
*/
|
|
57
|
+
export const FOLDERPANEL = [
|
|
58
|
+
{
|
|
59
|
+
_id: 'folder1',
|
|
60
|
+
fileCount: 10,
|
|
61
|
+
text: 'Documents',
|
|
62
|
+
missingFiles: 3,
|
|
63
|
+
pendingFiles: 2,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
_id: 'folder2',
|
|
67
|
+
fileCount: 5,
|
|
68
|
+
text: 'Images',
|
|
69
|
+
missingFiles: 0,
|
|
70
|
+
pendingFiles: 1,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
_id: 'folder3',
|
|
74
|
+
fileCount: 20,
|
|
75
|
+
text: 'Reports',
|
|
76
|
+
missingFiles: 5,
|
|
77
|
+
pendingFiles: 0,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
_id: 'folder4',
|
|
81
|
+
fileCount: 8,
|
|
82
|
+
text: 'Videos',
|
|
83
|
+
missingFiles: 0,
|
|
84
|
+
pendingFiles: 0,
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
_id: 'folder5',
|
|
88
|
+
fileCount: 15,
|
|
89
|
+
text: 'Archives',
|
|
90
|
+
missingFiles: 1,
|
|
91
|
+
pendingFiles: 3,
|
|
92
|
+
}
|
|
93
|
+
];
|
|
@@ -0,0 +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
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<lib-document-container></lib-document-container>
|
|
File without changes
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { TestBed } from '@angular/core/testing';
|
|
2
|
+
import { AppComponent } from './app.component';
|
|
3
|
+
|
|
4
|
+
describe('AppComponent', () => {
|
|
5
|
+
beforeEach(async () => {
|
|
6
|
+
await TestBed.configureTestingModule({
|
|
7
|
+
imports: [AppComponent],
|
|
8
|
+
}).compileComponents();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('should create the app', () => {
|
|
12
|
+
const fixture = TestBed.createComponent(AppComponent);
|
|
13
|
+
const app = fixture.componentInstance;
|
|
14
|
+
expect(app).toBeTruthy();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it(`should have the 'cat-documents-ng' title`, () => {
|
|
18
|
+
const fixture = TestBed.createComponent(AppComponent);
|
|
19
|
+
const app = fixture.componentInstance;
|
|
20
|
+
expect(app.title).toEqual('cat-documents-ng');
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('should render title', () => {
|
|
24
|
+
const fixture = TestBed.createComponent(AppComponent);
|
|
25
|
+
fixture.detectChanges();
|
|
26
|
+
const compiled = fixture.nativeElement as HTMLElement;
|
|
27
|
+
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, cat-documents-ng');
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { RouterOutlet } from '@angular/router';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
@Component({
|
|
8
|
+
selector: 'app-root',
|
|
9
|
+
standalone : false,
|
|
10
|
+
templateUrl: './app.component.html',
|
|
11
|
+
styleUrl: './app.component.scss'
|
|
12
|
+
})
|
|
13
|
+
export class AppComponent {
|
|
14
|
+
title = 'cat-documents-ng';
|
|
15
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { AppRoutingModule } from './app.routing.module';
|
|
4
|
+
import { AppComponent } from './app.component';
|
|
5
|
+
import { BrowserModule } from '@angular/platform-browser';
|
|
6
|
+
import { DocumentModule } from '../../projects/cat-document-lib/src/public-api';
|
|
7
|
+
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
8
|
+
import { GlobalErrorHandler } from '../../projects/cat-document-lib/src/shared/services/global-error.handler';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The root module of the Angular application.
|
|
12
|
+
*
|
|
13
|
+
* The `AppModule` is the starting point of the application, declaring the main application component,
|
|
14
|
+
* importing necessary Angular modules, and bootstrapping the root component.
|
|
15
|
+
*/
|
|
16
|
+
@NgModule({
|
|
17
|
+
declarations: [
|
|
18
|
+
/**
|
|
19
|
+
* Declares the main application component.
|
|
20
|
+
*/
|
|
21
|
+
AppComponent
|
|
22
|
+
],
|
|
23
|
+
imports: [
|
|
24
|
+
/**
|
|
25
|
+
* Provides Angular's commonly needed directives and pipes.
|
|
26
|
+
*/
|
|
27
|
+
CommonModule,
|
|
28
|
+
/**
|
|
29
|
+
* Handles routing configuration for the application.
|
|
30
|
+
*/
|
|
31
|
+
AppRoutingModule,
|
|
32
|
+
/**
|
|
33
|
+
* Provides essential Angular services for browser-based applications.
|
|
34
|
+
*/
|
|
35
|
+
BrowserModule,
|
|
36
|
+
/**
|
|
37
|
+
* Imports the custom DocumentModule, which contains document-related features.
|
|
38
|
+
*/
|
|
39
|
+
DocumentModule,
|
|
40
|
+
/**
|
|
41
|
+
* Enables animations for Angular components in the application.
|
|
42
|
+
*/
|
|
43
|
+
BrowserAnimationsModule
|
|
44
|
+
],
|
|
45
|
+
bootstrap: [
|
|
46
|
+
/**
|
|
47
|
+
* Specifies the root component to bootstrap the application.
|
|
48
|
+
*/
|
|
49
|
+
AppComponent
|
|
50
|
+
],
|
|
51
|
+
providers: [
|
|
52
|
+
/**
|
|
53
|
+
* Registers the global error handler for the application.
|
|
54
|
+
*/
|
|
55
|
+
{provide: GlobalErrorHandler, useClass: GlobalErrorHandler}
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
})
|
|
59
|
+
export class AppModule {}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { RouterModule, Routes } from '@angular/router';
|
|
3
|
+
import { AppComponent } from './app.component';
|
|
4
|
+
|
|
5
|
+
const routes: Routes = [
|
|
6
|
+
{
|
|
7
|
+
path : "",
|
|
8
|
+
component : AppComponent
|
|
9
|
+
}
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
@NgModule({
|
|
16
|
+
imports: [RouterModule.forChild(routes)],
|
|
17
|
+
exports: [RouterModule]
|
|
18
|
+
})
|
|
19
|
+
export class AppRoutingModule { }
|
package/src/index.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>CatDocumentsNg</title>
|
|
6
|
+
<base href="/">
|
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
8
|
+
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<app-root></app-root>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
package/src/main.ts
ADDED
package/src/styles.scss
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/* You can add global styles to this file, and also import other style files */
|
|
2
|
+
@import '../node_modules/primeng/resources/themes/saga-blue/theme.css';
|
|
3
|
+
@import '../node_modules/primeng/resources/primeng.min.css';
|
|
4
|
+
@import '../node_modules/primeflex/primeflex.min.css';
|
|
5
|
+
@import '../node_modules/primeicons/primeicons.css';
|
|
@@ -0,0 +1,15 @@
|
|
|
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/app",
|
|
7
|
+
"types": []
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"src/main.ts"
|
|
11
|
+
],
|
|
12
|
+
"include": [
|
|
13
|
+
"src/**/*.d.ts"
|
|
14
|
+
]
|
|
15
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
"compileOnSave": false,
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
"paths": {
|
|
7
|
+
"cat-document-lib": [
|
|
8
|
+
"./dist/cat-document-lib"
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
"outDir": "./dist/out-tsc",
|
|
12
|
+
"strict": true,
|
|
13
|
+
"noImplicitOverride": true,
|
|
14
|
+
"noPropertyAccessFromIndexSignature": true,
|
|
15
|
+
"noImplicitReturns": true,
|
|
16
|
+
"noFallthroughCasesInSwitch": true,
|
|
17
|
+
"skipLibCheck": true,
|
|
18
|
+
"isolatedModules": true,
|
|
19
|
+
"esModuleInterop": true,
|
|
20
|
+
"experimentalDecorators": true,
|
|
21
|
+
"moduleResolution": "bundler",
|
|
22
|
+
"importHelpers": true,
|
|
23
|
+
"target": "ES2022",
|
|
24
|
+
"module": "ES2022"
|
|
25
|
+
},
|
|
26
|
+
"angularCompilerOptions": {
|
|
27
|
+
"enableI18nLegacyMessageIdFormat": false,
|
|
28
|
+
"strictInjectionParameters": true,
|
|
29
|
+
"strictInputAccessModifiers": true,
|
|
30
|
+
"strictTemplates": true
|
|
31
|
+
}
|
|
32
|
+
}
|