cat-documents-ng 0.3.16 → 0.3.19

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.
@@ -75,11 +75,6 @@ export declare class DocumentContainerComponent implements OnInit, OnDestroy, On
75
75
  applicationNumber: string;
76
76
  catagories: DocumentCategory[];
77
77
  userList: UserListModel[];
78
- /**
79
- * Sorted menu items used to determine document section order
80
- * @type {DocumentCategory[]}
81
- */
82
- sortedMenuItems: DocumentCategory[];
83
78
  /**
84
79
  * Holds the subscription to manage observable cleanup.
85
80
  * @type {Subscription}
@@ -5,7 +5,8 @@ import { DocumentListService } from '../../services/document-list.service';
5
5
  import { Message } from 'primeng/api';
6
6
  import { DocumentHttpService } from '../../services/document-http.service';
7
7
  import { DocumentMenuService } from '../../services/document-menu.service';
8
- import { DocumentCategoryReorderService } from '../../services/document-category-reorder.service';
8
+ import { DocumentStore } from '../../state/document.store';
9
+ import { DocumentScrollService } from '../../services/document-scroll.service';
9
10
  import * as i0 from "@angular/core";
10
11
  /**
11
12
  * This component is responsible for displaying and managing a list of documents.
@@ -16,7 +17,8 @@ export declare class DocumentListComponent implements OnInit, OnDestroy, OnChang
16
17
  private documentListService;
17
18
  private documentHttpService;
18
19
  private documentMenuService;
19
- private documentCategoryReorderService;
20
+ private documentStore;
21
+ private documentScrollService;
20
22
  /**
21
23
  * Represents the context ID for the document list.
22
24
  * This value is passed from the parent component.
@@ -47,13 +49,6 @@ export declare class DocumentListComponent implements OnInit, OnDestroy, OnChang
47
49
  categoryLabel: string;
48
50
  categoryIndex: number;
49
51
  } | null;
50
- /**
51
- * Sorted menu items from the documents menu component
52
- * Used to determine the order of document sections
53
- * @type {any[]}
54
- * @memberof DocumentListComponent
55
- */
56
- sortedMenuItems: any[];
57
52
  /**
58
53
  * Reference to the document categories container for scrolling
59
54
  */
@@ -167,7 +162,7 @@ export declare class DocumentListComponent implements OnInit, OnDestroy, OnChang
167
162
  * @class
168
163
  * @param {DocumentListService} documentListService - The service responsible for document list operations.
169
164
  */
170
- constructor(documentListService: DocumentListService, documentHttpService: DocumentHttpService, documentMenuService: DocumentMenuService, documentCategoryReorderService: DocumentCategoryReorderService);
165
+ constructor(documentListService: DocumentListService, documentHttpService: DocumentHttpService, documentMenuService: DocumentMenuService, documentStore: DocumentStore, documentScrollService: DocumentScrollService);
171
166
  /**
172
167
  * Handles changes to input properties
173
168
  */
@@ -251,6 +246,10 @@ export declare class DocumentListComponent implements OnInit, OnDestroy, OnChang
251
246
  categoryLabel: string;
252
247
  categoryIndex: number;
253
248
  }): void;
249
+ /**
250
+ * Resets the document list to the top when menu item is deselected
251
+ */
252
+ private resetToTop;
254
253
  onDocumentNameChange(event: Event): void;
255
254
  handleSaveClick(): void;
256
255
  /**
@@ -258,5 +257,5 @@ export declare class DocumentListComponent implements OnInit, OnDestroy, OnChang
258
257
  */
259
258
  ngOnDestroy(): void;
260
259
  static ɵfac: i0.ɵɵFactoryDeclaration<DocumentListComponent, never>;
261
- static ɵcmp: i0.ɵɵComponentDeclaration<DocumentListComponent, "lib-document-list", never, { "contextId": { "alias": "contextId"; "required": false; }; "documentListResponse": { "alias": "documentListResponse"; "required": false; }; "selectedMenuItemId": { "alias": "selectedMenuItemId"; "required": false; }; "navigationInfo": { "alias": "navigationInfo"; "required": false; }; "sortedMenuItems": { "alias": "sortedMenuItems"; "required": false; }; "documentList": { "alias": "documentList"; "required": false; }; }, { "handleSelectedDocument": "handleSelectedDocument"; }, never, ["*"], false, never>;
260
+ static ɵcmp: i0.ɵɵComponentDeclaration<DocumentListComponent, "lib-document-list", never, { "contextId": { "alias": "contextId"; "required": false; }; "documentListResponse": { "alias": "documentListResponse"; "required": false; }; "selectedMenuItemId": { "alias": "selectedMenuItemId"; "required": false; }; "navigationInfo": { "alias": "navigationInfo"; "required": false; }; "documentList": { "alias": "documentList"; "required": false; }; }, { "handleSelectedDocument": "handleSelectedDocument"; }, never, ["*"], false, never>;
262
261
  }
@@ -1,11 +1,11 @@
1
- import { OnInit, OnChanges, SimpleChanges, EventEmitter } from '@angular/core';
1
+ import { OnInit, OnChanges, SimpleChanges, EventEmitter, OnDestroy } from '@angular/core';
2
2
  import { DocumentStore } from '../../state/document.store';
3
3
  import { DocumentQuery } from '../../state/document.query';
4
4
  import { DocumentCategory, DocumentCategoryItem } from '../../models/document-category.model';
5
5
  import { DocumentMenuService } from '../../services/document-menu.service';
6
6
  import { DocumentHelperService } from '../../services/document.service';
7
7
  import * as i0 from "@angular/core";
8
- export declare class DocumentsMenuComponent implements OnInit, OnChanges {
8
+ export declare class DocumentsMenuComponent implements OnInit, OnChanges, OnDestroy {
9
9
  private documentStore;
10
10
  private documentQuery;
11
11
  private documentMenuService;
@@ -26,6 +26,9 @@ export declare class DocumentsMenuComponent implements OnInit, OnChanges {
26
26
  selectedMenuItem: string | null;
27
27
  selectedMenuItemId: string | null;
28
28
  private storeCategories;
29
+ private _cachedCategories;
30
+ private selectedMenuItemSubscription;
31
+ private documentCategoriesSubscription;
29
32
  constructor(documentStore: DocumentStore, documentQuery: DocumentQuery, documentMenuService: DocumentMenuService, documentHelperService: DocumentHelperService);
30
33
  /**
31
34
  * Initialize the component
@@ -43,9 +46,14 @@ export declare class DocumentsMenuComponent implements OnInit, OnChanges {
43
46
  /**
44
47
  * Gets the categories to use for the menu
45
48
  * Priority: Store categories > Input categories
46
- * Categories and menu items are sorted alphabetically
49
+ * Categories maintain their original order as provided by the API
47
50
  */
48
51
  get categories(): DocumentCategory[];
52
+ /**
53
+ * Updates the cached categories when data changes
54
+ * Maintains the original order as provided by the API
55
+ */
56
+ private updateCachedCategories;
49
57
  /**
50
58
  * Finds the label of a menu item by its _id
51
59
  * @param id The _id to search for
@@ -68,15 +76,6 @@ export declare class DocumentsMenuComponent implements OnInit, OnChanges {
68
76
  * @param {DocumentCategoryItem} item - catagory item
69
77
  */
70
78
  onMenuItemClick(event: any, item: DocumentCategoryItem): void;
71
- /**
72
- * Handle the menu item selection
73
- * @param {string} menuItemId - The ID of the menu item to select
74
- */
75
- onSelectMenuItem(menuItemId: string): void;
76
- /**
77
- * Handle the menu item unselection
78
- */
79
- onUnselectMenuItem(): void;
80
79
  /**
81
80
  * Get the selected menu item
82
81
  * @returns {string | null} - The selected menu item
@@ -91,6 +90,11 @@ export declare class DocumentsMenuComponent implements OnInit, OnChanges {
91
90
  * @returns {string | null} - The selected menu item id
92
91
  */
93
92
  getSelectedMenuItemId(): string | null;
93
+ /**
94
+ * Clean up subscriptions when component is destroyed
95
+ * Prevents memory leaks and ensures proper cleanup
96
+ */
97
+ ngOnDestroy(): void;
94
98
  static ɵfac: i0.ɵɵFactoryDeclaration<DocumentsMenuComponent, never>;
95
99
  static ɵcmp: i0.ɵɵComponentDeclaration<DocumentsMenuComponent, "lib-documents-menu", never, { "catagories": { "alias": "catagories"; "required": false; }; "applicationNumber": { "alias": "applicationNumber"; "required": false; }; "contextId": { "alias": "contextId"; "required": false; }; }, { "menuItemSelected": "menuItemSelected"; }, never, never, false, never>;
96
100
  }
@@ -14,6 +14,7 @@ export interface DocumentListItem {
14
14
  ownerName: string;
15
15
  contentType: string;
16
16
  aliasName?: string;
17
+ documentType?: string;
17
18
  }
18
19
  /**
19
20
  * Represents the complete document list response
@@ -7,7 +7,6 @@ import { DocumentTableBuilderService } from './document-table-builder.service';
7
7
  import { DocumentHelperService } from './document.service';
8
8
  import { DocumentListItem, DocumentListResponse } from '../models/document-list-response.model';
9
9
  import { TableData } from '../../../Shared/components/table-primary/table-primary.model';
10
- import { DocumentSeverityService } from './document-severity.service';
11
10
  import * as i0 from "@angular/core";
12
11
  export declare class DocumentListService {
13
12
  private documentUploadService;
@@ -16,8 +15,7 @@ export declare class DocumentListService {
16
15
  private documentStore;
17
16
  private documentTableBuilder;
18
17
  private documentHelperService;
19
- private documentSeverityService;
20
- constructor(documentUploadService: DocumentUploadService, documentHttpService: DocumentHttpService, documentQuery: DocumentQuery, documentStore: DocumentStore, documentTableBuilder: DocumentTableBuilderService, documentHelperService: DocumentHelperService, documentSeverityService: DocumentSeverityService);
18
+ constructor(documentUploadService: DocumentUploadService, documentHttpService: DocumentHttpService, documentQuery: DocumentQuery, documentStore: DocumentStore, documentTableBuilder: DocumentTableBuilderService, documentHelperService: DocumentHelperService);
21
19
  /**
22
20
  * Handle file upload click event
23
21
  */
@@ -38,12 +36,6 @@ export declare class DocumentListService {
38
36
  * Get approved document count for a category
39
37
  */
40
38
  getApprovedDocumentCount(category: DocumentListResponse): number;
41
- /**
42
- * Sorts document categories alphabetically by label
43
- * @param categories - The list of document categories to sort
44
- * @returns Sorted categories array
45
- */
46
- sortDocumentCategoriesAlphabetically(categories: DocumentListResponse[]): DocumentListResponse[];
47
39
  /**
48
40
  * Build document categories from API response
49
41
  */
@@ -1,11 +1,9 @@
1
1
  import { DocumentCategory, DocumentCategoryItem } from '../models/document-category.model';
2
2
  import { DocumentStore } from '../state/document.store';
3
- import { DocumentSeverityService } from './document-severity.service';
4
3
  import * as i0 from "@angular/core";
5
4
  export declare class DocumentMenuService {
6
5
  private documentStore;
7
- private documentSeverityService;
8
- constructor(documentStore: DocumentStore, documentSeverityService: DocumentSeverityService);
6
+ constructor(documentStore: DocumentStore);
9
7
  /**
10
8
  * Sorts categories alphabetically by label
11
9
  * @param categories - The list of document categories to sort
@@ -0,0 +1,55 @@
1
+ import { OnDestroy } from '@angular/core';
2
+ import { DocumentStore } from '../state/document.store';
3
+ import * as i0 from "@angular/core";
4
+ export interface ScrollTarget {
5
+ element: Element;
6
+ menuItemId: string;
7
+ }
8
+ export declare class DocumentScrollService implements OnDestroy {
9
+ private documentStore;
10
+ private sectionObserver;
11
+ private currentObservedSection;
12
+ private isScrolling;
13
+ private scrollHandler;
14
+ private scrollTimeout;
15
+ constructor(documentStore: DocumentStore);
16
+ /**
17
+ * Sets up scroll event listeners to track scrolling state
18
+ * @param containerElement - The container element to monitor for scroll events
19
+ */
20
+ setupScrollListeners(containerElement: HTMLElement): void;
21
+ /**
22
+ * Sets up intersection observer to detect when the selected section scrolls out of view
23
+ * @param sectionElement - The section element to observe
24
+ * @param menuItemId - The ID of the selected menu item
25
+ */
26
+ setupSectionObserver(sectionElement: Element, menuItemId: string): void;
27
+ /**
28
+ * Disconnects the section observer
29
+ */
30
+ disconnectSectionObserver(): void;
31
+ /**
32
+ * Sets the scrolling flag to true (called when starting a scroll operation)
33
+ */
34
+ setScrolling(): void;
35
+ /**
36
+ * Resets the scrolling flag after a specified delay
37
+ * @param delay - Delay in milliseconds before resetting the flag
38
+ */
39
+ resetScrollingAfterDelay(delay?: number): void;
40
+ /**
41
+ * Gets the current scrolling state
42
+ */
43
+ get isCurrentlyScrolling(): boolean;
44
+ /**
45
+ * Cleans up all resources
46
+ */
47
+ ngOnDestroy(): void;
48
+ /**
49
+ * Removes scroll event listeners
50
+ * @param containerElement - The container element to remove listeners from
51
+ */
52
+ cleanupScrollListeners(containerElement?: HTMLElement): void;
53
+ static ɵfac: i0.ɵɵFactoryDeclaration<DocumentScrollService, never>;
54
+ static ɵprov: i0.ɵɵInjectableDeclaration<DocumentScrollService>;
55
+ }
@@ -9,13 +9,6 @@ export declare class DocumentTableBuilderService {
9
9
  * @returns TableData object
10
10
  */
11
11
  buildDocumentTable(documents: DocumentListItem[]): TableData;
12
- /**
13
- * Formats document name to include aliasName if available
14
- * @param docName The document name
15
- * @param aliasName The alias name (optional)
16
- * @returns Formatted display name
17
- */
18
- private formatDocumentDisplayName;
19
12
  /**
20
13
  * Gets completion count for a category
21
14
  * @param category Document category
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cat-documents-ng",
3
- "version": "0.3.16",
3
+ "version": "0.3.19",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^19.0.0",
6
6
  "@angular/core": "^19.0.0"
@@ -1,53 +0,0 @@
1
- import { DocumentListResponse } from '../models/document-list-response.model';
2
- import { TableData } from '../../../Shared/components/table-primary/table-primary.model';
3
- import * as i0 from "@angular/core";
4
- export interface CategoryData {
5
- category: DocumentListResponse;
6
- table: TableData;
7
- count: string;
8
- }
9
- /**
10
- * Service responsible for reordering document categories to match menu item order
11
- * This ensures sections are displayed in the same order as menu items
12
- */
13
- export declare class DocumentCategoryReorderService {
14
- constructor();
15
- /**
16
- * Reorders document categories to match the menu item order
17
- * This ensures sections are displayed in the same order as menu items
18
- * @param documentCategories - The document categories to reorder
19
- * @param categoryTables - The table data for each category
20
- * @param categoryCompletionCounts - The completion counts for each category
21
- * @param sortedMenuItems - The sorted menu items to determine order
22
- * @returns Object containing reordered categories, tables, and completion counts
23
- */
24
- reorderCategoriesByMenuItemOrder(documentCategories: DocumentListResponse[], categoryTables: TableData[], categoryCompletionCounts: string[], sortedMenuItems: any[]): {
25
- reorderedCategories: DocumentListResponse[];
26
- reorderedTables: TableData[];
27
- reorderedCompletionCounts: string[];
28
- };
29
- /**
30
- * Gets the menu item order from the sorted menu items input
31
- * This ensures sections are displayed in the same order as the sorted menu items
32
- * @param sortedMenuItems - The sorted menu items array
33
- * @returns Array of menu item labels in order
34
- */
35
- private getMenuItemOrder;
36
- /**
37
- * Builds a map of category labels to their order based on menu items
38
- * @param documentCategories - The document categories
39
- * @param menuItemOrder - The ordered menu item labels
40
- * @returns Map of category label to order index
41
- */
42
- private buildCategoryOrderMap;
43
- /**
44
- * Builds a map of original category data for reordering
45
- * @param documentCategories - The document categories
46
- * @param categoryTables - The table data for each category
47
- * @param categoryCompletionCounts - The completion counts for each category
48
- * @returns Map of category label to category data
49
- */
50
- private buildOriginalCategoryData;
51
- static ɵfac: i0.ɵɵFactoryDeclaration<DocumentCategoryReorderService, never>;
52
- static ɵprov: i0.ɵɵInjectableDeclaration<DocumentCategoryReorderService>;
53
- }
@@ -1,33 +0,0 @@
1
- import { DocumentListItem } from '../models/document-list-response.model';
2
- import * as i0 from "@angular/core";
3
- export type SeverityLevel = 'success' | 'info' | 'warning' | 'danger';
4
- export declare class DocumentSeverityService {
5
- constructor();
6
- /**
7
- * Calculate severity for a list of documents based on their statuses
8
- * This is the centralized severity calculation logic used across the application
9
- * @param documents The list of documents to calculate severity for
10
- * @returns Severity level for the document list
11
- */
12
- calculateSeverity(documents: DocumentListItem[]): SeverityLevel;
13
- /**
14
- * Calculate severity for a category based on document statuses
15
- * @param category The document category
16
- * @returns Severity level for the category
17
- */
18
- calculateCategorySeverity(category: any): SeverityLevel;
19
- /**
20
- * Calculate severity for a menu item based on status counts
21
- * @param status The status object with counts
22
- * @returns Severity level for the menu item
23
- */
24
- calculateMenuItemSeverity(status: any): SeverityLevel;
25
- /**
26
- * Helper method to get total count from status object
27
- * @param status The status object
28
- * @returns Total count
29
- */
30
- private getTotalFromStatus;
31
- static ɵfac: i0.ɵɵFactoryDeclaration<DocumentSeverityService, never>;
32
- static ɵprov: i0.ɵɵInjectableDeclaration<DocumentSeverityService>;
33
- }