cat-documents-ng 1.0.27 → 1.0.29
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/Shared/constant/URLS.d.ts +2 -0
- package/fesm2022/cat-documents-ng.mjs +132 -128
- package/fesm2022/cat-documents-ng.mjs.map +1 -1
- package/lib/document/services/document-http.service.d.ts +12 -0
- package/lib/document/services/document-scroll.service.d.ts +24 -10
- package/lib/document/services/document-upload-business.service.d.ts +8 -0
- package/lib/document/services/document-upload-data.service.d.ts +8 -0
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import * as i6 from '@angular/common';
|
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
import { firstValueFrom, EMPTY, tap, catchError, throwError, of, combineLatest, Subject, Observable, takeUntil, Subscription, debounceTime as debounceTime$1, distinctUntilChanged as distinctUntilChanged$1, BehaviorSubject } from 'rxjs';
|
|
6
6
|
import * as i2 from '@angular/common/http';
|
|
7
|
-
import {
|
|
7
|
+
import { HttpParams, HttpClientModule, HttpHeaders } from '@angular/common/http';
|
|
8
8
|
import { __decorate } from 'tslib';
|
|
9
9
|
import { EntityStore, StoreConfig, QueryEntity } from '@datorama/akita';
|
|
10
10
|
import { debounceTime, distinctUntilChanged, switchMap, map, catchError as catchError$1 } from 'rxjs/operators';
|
|
@@ -1106,6 +1106,8 @@ class URLS {
|
|
|
1106
1106
|
static DOCUMENT_REQUEST = "documents/requestDocument";
|
|
1107
1107
|
static VALUATION_REPORT = "valuationReport/";
|
|
1108
1108
|
static CONVERT_TO_PDF = "documents/convert-email-to-pdf";
|
|
1109
|
+
static BROKER_DOCUMENT_CATAGORIES = "documentTypes/getAllCategoriesForBrokerBySource/";
|
|
1110
|
+
static BROKER_DOCUMENT_TYPES = "documentTypes/getAllDocumentTypesForBrokerByCategoryId/";
|
|
1109
1111
|
}
|
|
1110
1112
|
|
|
1111
1113
|
/**
|
|
@@ -1421,10 +1423,7 @@ class DocumentHttpService {
|
|
|
1421
1423
|
getFoldersData(contextId) {
|
|
1422
1424
|
if (!contextId)
|
|
1423
1425
|
return EMPTY;
|
|
1424
|
-
|
|
1425
|
-
'Authorization': `Bearer 3def65bf-2dfc-466b-85a3-13cd1db0960e`
|
|
1426
|
-
});
|
|
1427
|
-
return this.http.get(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}${URLS.FOLDERS}${contextId}`, { headers }).pipe(tap((folders) => {
|
|
1426
|
+
return this.http.get(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}${URLS.FOLDERS}${contextId}`).pipe(tap((folders) => {
|
|
1428
1427
|
this.documentStore.setFolders(folders);
|
|
1429
1428
|
}), catchError((error) => {
|
|
1430
1429
|
return throwError(() => new Error(error));
|
|
@@ -1437,10 +1436,7 @@ class DocumentHttpService {
|
|
|
1437
1436
|
* @returns {Observable<any>} Observable that emits the transformed data for dropdown options.
|
|
1438
1437
|
*/
|
|
1439
1438
|
getDocumentCatagories(contextId) {
|
|
1440
|
-
|
|
1441
|
-
'Authorization': `Bearer 3def65bf-2dfc-466b-85a3-13cd1db0960e`
|
|
1442
|
-
});
|
|
1443
|
-
return this.http.get(`${this.apiUrl}${URLS.DOCUMENTS_CATAGORIES}/${contextId}`, { headers })
|
|
1439
|
+
return this.http.get(`${this.apiUrl}${URLS.DOCUMENTS_CATAGORIES}/${contextId}`)
|
|
1444
1440
|
.pipe(tap((response) => {
|
|
1445
1441
|
if (response && response.categories) {
|
|
1446
1442
|
this.documentStore.setDocumentCategories(response.categories);
|
|
@@ -1470,10 +1466,7 @@ class DocumentHttpService {
|
|
|
1470
1466
|
* @returns {Observable<any>} Observable that emits the transformed data for dropdown options.
|
|
1471
1467
|
*/
|
|
1472
1468
|
getAlertsByDocumentID(documentId) {
|
|
1473
|
-
|
|
1474
|
-
'Authorization': `Bearer 3def65bf-2dfc-466b-85a3-13cd1db0960e`
|
|
1475
|
-
});
|
|
1476
|
-
return this.http.get(`${this.apiUrl}${URLS.ALERT_BY_DOCUMENT_ID}${documentId}`, { headers }).pipe(tap((documentAlert) => {
|
|
1469
|
+
return this.http.get(`${this.apiUrl}${URLS.ALERT_BY_DOCUMENT_ID}${documentId}`).pipe(tap((documentAlert) => {
|
|
1477
1470
|
this.documentStore.setDocumentAlert(documentAlert);
|
|
1478
1471
|
}), catchError((error) => {
|
|
1479
1472
|
return throwError(() => new Error(error));
|
|
@@ -1486,10 +1479,7 @@ class DocumentHttpService {
|
|
|
1486
1479
|
* @returns {Observable<any>} Observable that emits the transformed data for dropdown options.
|
|
1487
1480
|
*/
|
|
1488
1481
|
getDocumentByFolderID(folderId, contextId) {
|
|
1489
|
-
|
|
1490
|
-
'Authorization': `Bearer 3def65bf-2dfc-466b-85a3-13cd1db0960e`
|
|
1491
|
-
});
|
|
1492
|
-
return this.http.get(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}/${URLS.PARENT_DOCUMENT_TYPE_ID}${folderId}${URLS.CONTEXT_ID}${contextId}`, { headers }).pipe(tap((records) => {
|
|
1482
|
+
return this.http.get(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD}/${URLS.PARENT_DOCUMENT_TYPE_ID}${folderId}${URLS.CONTEXT_ID}${contextId}`).pipe(tap((records) => {
|
|
1493
1483
|
this.documentStore.set(records);
|
|
1494
1484
|
}), catchError((error) => {
|
|
1495
1485
|
return throwError(() => new Error(error));
|
|
@@ -1504,10 +1494,7 @@ class DocumentHttpService {
|
|
|
1504
1494
|
* @returns {Observable<DocumentModel>} An observable that emits the updated DocumentModel.
|
|
1505
1495
|
*/
|
|
1506
1496
|
updateDocumentName(documentId, payload) {
|
|
1507
|
-
|
|
1508
|
-
'Authorization': `Bearer 3def65bf-2dfc-466b-85a3-13cd1db0960e`
|
|
1509
|
-
});
|
|
1510
|
-
return this.http.put(`${this.apiUrl}${URLS.ALIAS_NAME}${documentId}`, payload, { headers }).pipe(catchError((error) => {
|
|
1497
|
+
return this.http.put(`${this.apiUrl}${URLS.ALIAS_NAME}${documentId}`, payload).pipe(catchError((error) => {
|
|
1511
1498
|
return throwError(() => new Error(error));
|
|
1512
1499
|
}));
|
|
1513
1500
|
}
|
|
@@ -1519,10 +1506,7 @@ class DocumentHttpService {
|
|
|
1519
1506
|
getUserListByContextId(contextId) {
|
|
1520
1507
|
if (!contextId)
|
|
1521
1508
|
return EMPTY;
|
|
1522
|
-
|
|
1523
|
-
'Authorization': `Bearer 3def65bf-2dfc-466b-85a3-13cd1db0960e`
|
|
1524
|
-
});
|
|
1525
|
-
return this.http.get(`${this.apiUrl}${URLS.USERLIST}${contextId}`, { headers }).pipe(tap((userList) => {
|
|
1509
|
+
return this.http.get(`${this.apiUrl}${URLS.USERLIST}${contextId}`).pipe(tap((userList) => {
|
|
1526
1510
|
this.documentStore.setUserList(userList);
|
|
1527
1511
|
}), catchError((error) => {
|
|
1528
1512
|
return throwError(() => new Error(error));
|
|
@@ -1538,9 +1522,6 @@ class DocumentHttpService {
|
|
|
1538
1522
|
getStatusDocumentCount(applicationId, contextId = null, categoryId = null) {
|
|
1539
1523
|
if (!applicationId)
|
|
1540
1524
|
return EMPTY;
|
|
1541
|
-
let headers = new HttpHeaders({
|
|
1542
|
-
'Authorization': `Bearer 3def65bf-2dfc-466b-85a3-13cd1db0960e`
|
|
1543
|
-
});
|
|
1544
1525
|
let url = `${this.apiUrl}${URLS.STATUS_DOCUMENT_COUNT}${applicationId}`;
|
|
1545
1526
|
let params = new HttpParams();
|
|
1546
1527
|
const contextParam = contextId || null;
|
|
@@ -1550,7 +1531,7 @@ class DocumentHttpService {
|
|
|
1550
1531
|
if (categoryId) {
|
|
1551
1532
|
params = params.set(SHARED.CATEGORY, categoryId);
|
|
1552
1533
|
}
|
|
1553
|
-
return this.http.get(url, { params
|
|
1534
|
+
return this.http.get(url, { params }).pipe(tap((statusData) => {
|
|
1554
1535
|
this.documentStore.setStatusData(statusData);
|
|
1555
1536
|
}), catchError((error) => {
|
|
1556
1537
|
return throwError(() => new Error(error));
|
|
@@ -1568,9 +1549,6 @@ class DocumentHttpService {
|
|
|
1568
1549
|
* @returns {Observable<any>} An observable that emits the filtered document data.
|
|
1569
1550
|
*/
|
|
1570
1551
|
getDocumentsBySelection(contextId, menuItem, userId, status, searchKey = null) {
|
|
1571
|
-
let headers = new HttpHeaders({
|
|
1572
|
-
'Authorization': `Bearer 3def65bf-2dfc-466b-85a3-13cd1db0960e`
|
|
1573
|
-
});
|
|
1574
1552
|
let params = new HttpParams();
|
|
1575
1553
|
if (userId) {
|
|
1576
1554
|
params = params.set(SHARED.CONTEXT_ID, userId);
|
|
@@ -1581,7 +1559,7 @@ class DocumentHttpService {
|
|
|
1581
1559
|
if (searchKey) {
|
|
1582
1560
|
params = params.set(SHARED.SEARCH_KEY, searchKey);
|
|
1583
1561
|
}
|
|
1584
|
-
return this.http.get(`${this.apiUrl}${URLS.GETALL}/${contextId}`, { params
|
|
1562
|
+
return this.http.get(`${this.apiUrl}${URLS.GETALL}/${contextId}`, { params }).pipe(tap((response) => {
|
|
1585
1563
|
if (response.documents) {
|
|
1586
1564
|
this.documentStore.setDocumentList(response.documents);
|
|
1587
1565
|
}
|
|
@@ -1593,10 +1571,7 @@ class DocumentHttpService {
|
|
|
1593
1571
|
if (!documentId) {
|
|
1594
1572
|
return of([]);
|
|
1595
1573
|
}
|
|
1596
|
-
|
|
1597
|
-
'Authorization': `Bearer 3def65bf-2dfc-466b-85a3-13cd1db0960e`
|
|
1598
|
-
});
|
|
1599
|
-
return this.http.get(`${this.apiUrl}${URLS.DOCUMENT_HISTORY}${documentId}`, { headers }).pipe(catchError((error) => {
|
|
1574
|
+
return this.http.get(`${this.apiUrl}${URLS.DOCUMENT_HISTORY}${documentId}`).pipe(catchError((error) => {
|
|
1600
1575
|
return throwError(() => new Error(error));
|
|
1601
1576
|
}));
|
|
1602
1577
|
}
|
|
@@ -1608,10 +1583,31 @@ class DocumentHttpService {
|
|
|
1608
1583
|
getCategoriesBySource(source) {
|
|
1609
1584
|
if (!source)
|
|
1610
1585
|
return EMPTY;
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
});
|
|
1614
|
-
|
|
1586
|
+
return this.http.get(`${this.apiUrl}${URLS.GET_CATEGORIES_BY_SOURCE}${source}`).pipe(catchError((error) => {
|
|
1587
|
+
return throwError(() => new Error(error));
|
|
1588
|
+
}));
|
|
1589
|
+
}
|
|
1590
|
+
/**
|
|
1591
|
+
* Fetches broker document categories by source.
|
|
1592
|
+
* @param {string} source - The source type (Broker).
|
|
1593
|
+
* @returns {Observable<DocumentCategory[]>} Observable that emits the categories.
|
|
1594
|
+
*/
|
|
1595
|
+
getBrokerDocumentCatagoriesBySource(source) {
|
|
1596
|
+
if (!source)
|
|
1597
|
+
return EMPTY;
|
|
1598
|
+
return this.http.get(`${this.apiUrl}${URLS.BROKER_DOCUMENT_CATAGORIES}${source}`).pipe(catchError((error) => {
|
|
1599
|
+
return throwError(() => new Error(error));
|
|
1600
|
+
}));
|
|
1601
|
+
}
|
|
1602
|
+
/**
|
|
1603
|
+
* Fetches broker document types by category ID.
|
|
1604
|
+
* @param {string} categoryId - The category ID to fetch document types for.
|
|
1605
|
+
* @returns {Observable<DocumentTypeModel[]>} Observable that emits the document types.
|
|
1606
|
+
*/
|
|
1607
|
+
getBrokerDocumentTypesByCategoryId(categoryId) {
|
|
1608
|
+
if (!categoryId)
|
|
1609
|
+
return EMPTY;
|
|
1610
|
+
return this.http.get(`${this.apiUrl}${URLS.BROKER_DOCUMENT_TYPES}${categoryId}`).pipe(catchError((error) => {
|
|
1615
1611
|
return throwError(() => new Error(error));
|
|
1616
1612
|
}));
|
|
1617
1613
|
}
|
|
@@ -1623,10 +1619,7 @@ class DocumentHttpService {
|
|
|
1623
1619
|
getDocumentTypesByCategory(categoryId) {
|
|
1624
1620
|
if (!categoryId)
|
|
1625
1621
|
return EMPTY;
|
|
1626
|
-
|
|
1627
|
-
'Authorization': `Bearer 3def65bf-2dfc-466b-85a3-13cd1db0960e`
|
|
1628
|
-
});
|
|
1629
|
-
return this.http.get(`${this.apiUrl}${URLS.GET_DOCUMENT_TYPES_BY_CATEGORY}${categoryId}`, { headers }).pipe(catchError((error) => {
|
|
1622
|
+
return this.http.get(`${this.apiUrl}${URLS.GET_DOCUMENT_TYPES_BY_CATEGORY}${categoryId}`).pipe(catchError((error) => {
|
|
1630
1623
|
return throwError(() => new Error(error));
|
|
1631
1624
|
}));
|
|
1632
1625
|
}
|
|
@@ -1636,10 +1629,7 @@ class DocumentHttpService {
|
|
|
1636
1629
|
* @returns {Observable<any>} Observable that emits the upload response.
|
|
1637
1630
|
*/
|
|
1638
1631
|
uploadFile(formData) {
|
|
1639
|
-
|
|
1640
|
-
'Authorization': `Bearer 3def65bf-2dfc-466b-85a3-13cd1db0960e`
|
|
1641
|
-
});
|
|
1642
|
-
return this.http.post(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD_FILE}`, formData, { headers }).pipe(catchError((error) => {
|
|
1632
|
+
return this.http.post(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD_FILE}`, formData).pipe(catchError((error) => {
|
|
1643
1633
|
return throwError(() => new Error(error));
|
|
1644
1634
|
}));
|
|
1645
1635
|
}
|
|
@@ -1649,10 +1639,7 @@ class DocumentHttpService {
|
|
|
1649
1639
|
* @returns {Observable<any>} Observable that emits the save response.
|
|
1650
1640
|
*/
|
|
1651
1641
|
saveDocumentUpload(payload) {
|
|
1652
|
-
|
|
1653
|
-
'Authorization': `Bearer 3def65bf-2dfc-466b-85a3-13cd1db0960e`
|
|
1654
|
-
});
|
|
1655
|
-
return this.http.post(`${this.apiUrl}${URLS.SAVE_DOCUMENT_UPLOAD}`, payload, { headers }).pipe(catchError((error) => {
|
|
1642
|
+
return this.http.post(`${this.apiUrl}${URLS.SAVE_DOCUMENT_UPLOAD}`, payload).pipe(catchError((error) => {
|
|
1656
1643
|
return throwError(() => new Error(error));
|
|
1657
1644
|
}));
|
|
1658
1645
|
}
|
|
@@ -1667,10 +1654,7 @@ class DocumentHttpService {
|
|
|
1667
1654
|
const payload = {
|
|
1668
1655
|
statusUpdateDescription: statusUpdateDescription
|
|
1669
1656
|
};
|
|
1670
|
-
|
|
1671
|
-
'Authorization': `Bearer 3def65bf-2dfc-466b-85a3-13cd1db0960e`
|
|
1672
|
-
});
|
|
1673
|
-
return this.http.put(`${this.apiUrl}${URLS.UPDATE_DOCUMENT_STATUS}${documentId}/${status}`, payload, { headers }).pipe(tap((response) => {
|
|
1657
|
+
return this.http.put(`${this.apiUrl}${URLS.UPDATE_DOCUMENT_STATUS}${documentId}/${status}`, payload).pipe(tap((response) => {
|
|
1674
1658
|
if (response && response.status) {
|
|
1675
1659
|
const normalizedStatus = this.normalizeStatus(response.status);
|
|
1676
1660
|
response.normalizedStatus = normalizedStatus;
|
|
@@ -1703,10 +1687,7 @@ class DocumentHttpService {
|
|
|
1703
1687
|
* @returns {Observable<any>} Observable that emits the delete response
|
|
1704
1688
|
*/
|
|
1705
1689
|
deleteDocument(documentId, contextId) {
|
|
1706
|
-
|
|
1707
|
-
'Authorization': `Bearer 3def65bf-2dfc-466b-85a3-13cd1db0960e`
|
|
1708
|
-
});
|
|
1709
|
-
return this.http.delete(`${this.apiUrl}${URLS.DELETE_DOCUMENT}${documentId}`, { headers }).pipe(tap(() => {
|
|
1690
|
+
return this.http.delete(`${this.apiUrl}${URLS.DELETE_DOCUMENT}${documentId}`).pipe(tap(() => {
|
|
1710
1691
|
this.getDocumentCatagories(contextId).subscribe();
|
|
1711
1692
|
this.getUserListByContextId(contextId).subscribe();
|
|
1712
1693
|
this.getStatusDocumentCount(contextId).subscribe();
|
|
@@ -1722,10 +1703,7 @@ class DocumentHttpService {
|
|
|
1722
1703
|
* @returns {Observable<ArrayBuffer>} Observable that emits the file data as ArrayBuffer
|
|
1723
1704
|
*/
|
|
1724
1705
|
downloadExcelFile(documentUrl) {
|
|
1725
|
-
|
|
1726
|
-
'Authorization': `Bearer 3def65bf-2dfc-466b-85a3-13cd1db0960e`
|
|
1727
|
-
});
|
|
1728
|
-
return this.http.get(documentUrl, { headers,
|
|
1706
|
+
return this.http.get(documentUrl, {
|
|
1729
1707
|
responseType: 'arraybuffer'
|
|
1730
1708
|
}).pipe(catchError((error) => {
|
|
1731
1709
|
return throwError(() => new Error(error));
|
|
@@ -1738,10 +1716,7 @@ class DocumentHttpService {
|
|
|
1738
1716
|
* @returns {Observable<string>} Observable that emits the file data as string
|
|
1739
1717
|
*/
|
|
1740
1718
|
downloadCsvFile(documentUrl) {
|
|
1741
|
-
|
|
1742
|
-
'Authorization': `Bearer 3def65bf-2dfc-466b-85a3-13cd1db0960e`
|
|
1743
|
-
});
|
|
1744
|
-
return this.http.get(documentUrl, { headers,
|
|
1719
|
+
return this.http.get(documentUrl, {
|
|
1745
1720
|
responseType: 'text'
|
|
1746
1721
|
}).pipe(catchError((error) => {
|
|
1747
1722
|
return throwError(() => new Error(error));
|
|
@@ -1753,28 +1728,22 @@ class DocumentHttpService {
|
|
|
1753
1728
|
* @returns Observable of file content as text
|
|
1754
1729
|
*/
|
|
1755
1730
|
downloadEmailFile(documentUrl) {
|
|
1756
|
-
let headers = new HttpHeaders({
|
|
1757
|
-
'Authorization': `Bearer 3def65bf-2dfc-466b-85a3-13cd1db0960e`
|
|
1758
|
-
});
|
|
1759
1731
|
const isAzureBlobStorage = documentUrl.includes('.blob.core.windows.net');
|
|
1760
1732
|
if (isAzureBlobStorage) {
|
|
1761
|
-
return this.http.get(documentUrl, {
|
|
1733
|
+
return this.http.get(documentUrl, {
|
|
1762
1734
|
responseType: 'text'
|
|
1763
1735
|
}).pipe(catchError((error) => {
|
|
1764
1736
|
return throwError(() => new Error('Failed to download email file. Please check if the file URL is valid and accessible.'));
|
|
1765
1737
|
}));
|
|
1766
1738
|
}
|
|
1767
1739
|
else {
|
|
1768
|
-
return this.http.get(documentUrl
|
|
1740
|
+
return this.http.get(documentUrl).pipe(catchError((error) => {
|
|
1769
1741
|
return throwError(() => new Error('Failed to download email file. Please check if the file URL is valid and accessible.'));
|
|
1770
1742
|
}));
|
|
1771
1743
|
}
|
|
1772
1744
|
}
|
|
1773
1745
|
documentRequest(payload) {
|
|
1774
|
-
|
|
1775
|
-
'Authorization': `Bearer 3def65bf-2dfc-466b-85a3-13cd1db0960e`
|
|
1776
|
-
});
|
|
1777
|
-
return this.http.post(`${this.apiUrl}${URLS.DOCUMENT_REQUEST}`, payload, { headers }).pipe(catchError((error) => {
|
|
1746
|
+
return this.http.post(`${this.apiUrl}${URLS.DOCUMENT_REQUEST}`, payload).pipe(catchError((error) => {
|
|
1778
1747
|
return throwError(() => new Error(error));
|
|
1779
1748
|
}));
|
|
1780
1749
|
}
|
|
@@ -1786,10 +1755,7 @@ class DocumentHttpService {
|
|
|
1786
1755
|
getValuationReportByContextId(contextId) {
|
|
1787
1756
|
if (!contextId)
|
|
1788
1757
|
return EMPTY;
|
|
1789
|
-
|
|
1790
|
-
'Authorization': `Bearer 3def65bf-2dfc-466b-85a3-13cd1db0960e`
|
|
1791
|
-
});
|
|
1792
|
-
return this.http.get(`${this.apiUrl}${URLS.VALUATION_REPORT}${contextId}`, { headers }).pipe(catchError((error) => {
|
|
1758
|
+
return this.http.get(`${this.apiUrl}${URLS.VALUATION_REPORT}${contextId}`).pipe(catchError((error) => {
|
|
1793
1759
|
// Return empty object if no data found or error occurs
|
|
1794
1760
|
return of(null);
|
|
1795
1761
|
}));
|
|
@@ -1803,10 +1769,7 @@ class DocumentHttpService {
|
|
|
1803
1769
|
if (!documentUrl)
|
|
1804
1770
|
return EMPTY;
|
|
1805
1771
|
const payload = { documentUrl: documentUrl };
|
|
1806
|
-
|
|
1807
|
-
'Authorization': `Bearer 3def65bf-2dfc-466b-85a3-13cd1db0960e`
|
|
1808
|
-
});
|
|
1809
|
-
return this.http.post(`${this.apiUrl}${URLS.CONVERT_TO_PDF}`, payload, { headers,
|
|
1772
|
+
return this.http.post(`${this.apiUrl}${URLS.CONVERT_TO_PDF}`, payload, {
|
|
1810
1773
|
responseType: 'blob'
|
|
1811
1774
|
}).pipe(catchError((error) => {
|
|
1812
1775
|
return throwError(() => new Error(error?.message || 'Failed to convert email to PDF'));
|
|
@@ -2732,10 +2695,7 @@ class DocumentService {
|
|
|
2732
2695
|
* @returns {Observable<any>} Observable that emits the newly created document.
|
|
2733
2696
|
*/
|
|
2734
2697
|
create(entity) {
|
|
2735
|
-
|
|
2736
|
-
'Authorization': `Bearer 3def65bf-2dfc-466b-85a3-13cd1db0960e`
|
|
2737
|
-
});
|
|
2738
|
-
return this.http.post(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD_FILE}`, entity, { headers }).pipe(tap((newEntity) => this.documentStore.add(newEntity)));
|
|
2698
|
+
return this.http.post(`${this.apiUrl}${URLS.DOCUMENT_UPLOAD_FILE}`, entity).pipe(tap((newEntity) => this.documentStore.add(newEntity)));
|
|
2739
2699
|
}
|
|
2740
2700
|
/**
|
|
2741
2701
|
* Fetches all documents from the backend.
|
|
@@ -3054,12 +3014,24 @@ class DocumentUploadBusinessService {
|
|
|
3054
3014
|
loadCategories(assignmentType) {
|
|
3055
3015
|
return this.documentHttpService.getCategoriesBySource(assignmentType);
|
|
3056
3016
|
}
|
|
3017
|
+
/**
|
|
3018
|
+
* Loads categories based on assignment type
|
|
3019
|
+
*/
|
|
3020
|
+
loadBrokerCategories(assignmentType) {
|
|
3021
|
+
return this.documentHttpService.getBrokerDocumentCatagoriesBySource(assignmentType);
|
|
3022
|
+
}
|
|
3057
3023
|
/**
|
|
3058
3024
|
* Loads document types based on category
|
|
3059
3025
|
*/
|
|
3060
3026
|
loadDocumentTypes(categoryId) {
|
|
3061
3027
|
return this.documentHttpService.getDocumentTypesByCategory(categoryId);
|
|
3062
3028
|
}
|
|
3029
|
+
/**
|
|
3030
|
+
* Loads broker document types based on category
|
|
3031
|
+
*/
|
|
3032
|
+
loadBrokerDocumentTypes(categoryId) {
|
|
3033
|
+
return this.documentHttpService.getBrokerDocumentTypesByCategoryId(categoryId);
|
|
3034
|
+
}
|
|
3063
3035
|
/**
|
|
3064
3036
|
* Filters applicants based on assignment type
|
|
3065
3037
|
*/
|
|
@@ -3396,6 +3368,21 @@ class DocumentUploadDataService {
|
|
|
3396
3368
|
}
|
|
3397
3369
|
return this.businessService.loadCategories(assignmentType);
|
|
3398
3370
|
}
|
|
3371
|
+
/**
|
|
3372
|
+
* Loads categories and handles the response
|
|
3373
|
+
*/
|
|
3374
|
+
loadBrokerCategories(assignmentType, onSuccess, onError) {
|
|
3375
|
+
if (!assignmentType) {
|
|
3376
|
+
return new Observable();
|
|
3377
|
+
}
|
|
3378
|
+
return this.businessService.loadBrokerCategories(assignmentType);
|
|
3379
|
+
}
|
|
3380
|
+
/**
|
|
3381
|
+
* Loads broker document types and handles the response
|
|
3382
|
+
*/
|
|
3383
|
+
loadBrokerDocumentTypes(categoryId, onSuccess, onError) {
|
|
3384
|
+
return this.businessService.loadBrokerDocumentTypes(categoryId);
|
|
3385
|
+
}
|
|
3399
3386
|
/**
|
|
3400
3387
|
* Loads document types and handles the response
|
|
3401
3388
|
*/
|
|
@@ -4158,14 +4145,14 @@ class RequestDocumentComponent {
|
|
|
4158
4145
|
}
|
|
4159
4146
|
loadCategories() {
|
|
4160
4147
|
this.isLoadingCategories = true;
|
|
4161
|
-
this.dataService.
|
|
4148
|
+
this.dataService.loadBrokerCategories(this.selectedAssignmentType, (categories) => this.handleCategoriesLoaded(categories), (error) => this.handleError('Failed to Load Categories', error, () => this.isLoadingCategories = false)).pipe(takeUntil(this.destroy$)).subscribe({
|
|
4162
4149
|
next: (categories) => this.handleCategoriesLoaded(categories),
|
|
4163
4150
|
error: (error) => this.handleError('Failed to Load Categories', error, () => this.isLoadingCategories = false)
|
|
4164
4151
|
});
|
|
4165
4152
|
}
|
|
4166
4153
|
loadDocumentTypes() {
|
|
4167
4154
|
this.isLoadingDocumentTypes = true;
|
|
4168
|
-
this.dataService.
|
|
4155
|
+
this.dataService.loadBrokerDocumentTypes(this.selectedCategory, (documentTypes) => this.handleDocumentTypesLoaded(documentTypes), (error) => this.handleError('Failed to Load Document Types', error, () => this.isLoadingDocumentTypes = false)).pipe(takeUntil(this.destroy$)).subscribe({
|
|
4169
4156
|
next: (documentTypes) => this.handleDocumentTypesLoaded(documentTypes),
|
|
4170
4157
|
error: (error) => this.handleError('Failed to Load Document Types', error, () => this.isLoadingDocumentTypes = false)
|
|
4171
4158
|
});
|
|
@@ -4792,11 +4779,11 @@ class DocumentSearchComponent {
|
|
|
4792
4779
|
}
|
|
4793
4780
|
};
|
|
4794
4781
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DocumentSearchComponent, deps: [{ token: DocumentHelperService }, { token: DocumentQuery }], target: i0.ɵɵFactoryTarget.Component });
|
|
4795
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: DocumentSearchComponent, isStandalone: false, selector: "document-search", inputs: { contextId: "contextId" }, outputs: { onActionClick: "onActionClick", onRequestClick: "onRequestClick" }, ngImport: i0, template: "<div class=\"search-container\">\r\n <div class=\"search-header\">\r\n <h2 class=\"ml-3 document-heading\">Documents</h2> \r\n </div>\r\n <div class=\"search-input-wrapper\">\r\n <i class=\"pi pi-search search-icon\"></i
|
|
4782
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: DocumentSearchComponent, isStandalone: false, selector: "document-search", inputs: { contextId: "contextId" }, outputs: { onActionClick: "onActionClick", onRequestClick: "onRequestClick" }, ngImport: i0, template: "<div class=\"search-container\">\r\n <div class=\"search-header\">\r\n <h2 class=\"ml-3 document-heading\">Documents</h2> \r\n </div>\r\n <div class=\"search-input-wrapper\">\r\n <!-- <i class=\"pi pi-search search-icon\"></i> -->\r\n <input \r\n type=\"text\" \r\n [(ngModel)]=\"searchTerm\"\r\n (ngModelChange)=\"onSearchInputChange($event)\"\r\n class=\"search-input\"\r\n placeholder=\"Search by document name, category, type, status or applicant name...\"\r\n [attr.aria-label]=\"'Search documents'\"\r\n />\r\n <button \r\n *ngIf=\"searchTerm\"\r\n type=\"button\"\r\n class=\"clear-button\"\r\n (click)=\"onClearSearch()\"\r\n [attr.aria-label]=\"'Clear search'\"\r\n >\r\n <i class=\"pi pi-times\"></i>\r\n </button>\r\n </div>\r\n\r\n <button \r\n *ngIf=\"shouldShowClearAll\"\r\n type=\"button\"\r\n class=\"clear-all-filters-link\"\r\n (click)=\"onClearAllFilters()\"\r\n [attr.aria-label]=\"'Clear all'\"\r\n >\r\n Clear All\r\n <i class=\"pi pi-times\"></i>\r\n </button>\r\n\r\n <div class=\"filters-section\">\r\n <div class=\"actions-menu\">\r\n <button \r\n type=\"button\"\r\n class=\"actions-btn\" \r\n (click)=\"toggleActionsMenu()\" \r\n [class.active]=\"showActionsMenu\"\r\n [attr.aria-label]=\"'Open actions menu'\"\r\n [attr.aria-expanded]=\"showActionsMenu\"\r\n >\r\n Actions\r\n <i class=\"pi pi-chevron-down\" [class.rotated]=\"showActionsMenu\"></i>\r\n </button>\r\n\r\n <!-- Actions Dropdown Menu -->\r\n <div class=\"actions-dropdown\" *ngIf=\"showActionsMenu\">\r\n <div class=\"dropdown-item\" (click)=\"handleUploadDocument()\">\r\n <i class=\"pi pi-upload\"></i>\r\n <span>Upload Document</span>\r\n </div>\r\n <div class=\"dropdown-item\" (click)=\"handleRequestDocument()\">\r\n <i class=\"pi pi-file\"></i>\r\n <span>Request Document</span>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div> ", styles: [".search-container{display:flex;align-items:center;gap:1rem;width:100%;justify-content:flex-start;padding:10px}.search-input-wrapper{position:relative;flex:1;display:flex;align-items:center;max-width:50%;min-width:300px}.clear-all-filters-link{background:none;border:none;color:#0f8bfd;cursor:pointer;padding:8px 12px;border-radius:4px;font-size:16px;font-weight:500;text-decoration:none!important;transition:background-color .2s ease,color .2s ease;white-space:nowrap;flex-shrink:0;display:flex;justify-content:center;align-items:center;gap:4px}.filters-section{display:flex;align-items:center;gap:1rem;flex-shrink:0;margin-left:auto}.filters-section .actions-menu{position:relative}.filters-section .actions-menu .actions-btn{background:#0f8bfd;border:none;border-radius:8px;padding:8px 10px;color:#fff;font-size:12px;font-weight:700;cursor:pointer;display:flex;align-items:center;gap:.5rem;transition:all .2s ease;white-space:nowrap}.filters-section .actions-menu .actions-btn:hover{background:#0d7ae6;transform:translateY(-1px)}.filters-section .actions-menu .actions-btn:active{transform:translateY(0)}.filters-section .actions-menu .actions-btn.active{background:#0d7ae6}.filters-section .actions-menu .actions-btn:focus{outline:none;box-shadow:0 0 0 3px #0f8bfd4d}.filters-section .actions-menu .actions-btn i{font-size:.75rem;transition:transform .2s}.filters-section .actions-menu .actions-btn i.rotated{transform:rotate(180deg)}.filters-section .actions-menu .actions-dropdown{position:absolute;top:calc(100% + .5rem);right:0;background:#fff;border:1px solid #d1d5db;border-radius:8px;box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f;z-index:1000;min-width:200px;overflow:hidden}.filters-section .actions-menu .actions-dropdown .dropdown-item{padding:.75rem 1rem;cursor:pointer;color:#374151;font-size:.875rem;transition:background-color .2s;display:flex;align-items:center;gap:.75rem}.filters-section .actions-menu .actions-dropdown .dropdown-item i{font-size:1rem;color:#6b7280}.filters-section .actions-menu .actions-dropdown .dropdown-item:hover{background-color:#f3f4f6}.filters-section .actions-menu .actions-dropdown .dropdown-item:not(:last-child){border-bottom:1px solid #f3f4f6}.filters-section .actions-menu .actions-dropdown .dropdown-item:active{background-color:#e5e7eb}.search-icon{position:absolute;left:12px;color:#6c757d;z-index:1}.search-input{width:100%;padding:10px 12px;border:1px solid #dee2e6;border-radius:8px;font-size:14px;outline:none;transition:border-color .2s ease,box-shadow .2s ease}.search-input:focus{border-color:#0f8bfd;box-shadow:0 0 0 3px #0f8bfd1a}.search-input::placeholder{color:#6c757d}.clear-button{position:absolute;right:12px;background:none;border:none;color:#6c757d;cursor:pointer;padding:4px;border-radius:4px;transition:background-color .2s ease,color .2s ease}.clear-button:hover{background-color:#f8f9fa;color:#495057}@media (max-width: 768px){.search-container{flex-direction:column;gap:.75rem}.search-input-wrapper{max-width:100%}.filters-section{width:100%;justify-content:center;gap:.5rem}.filters-section .actions-menu .actions-btn{width:auto;justify-content:center}.filters-section .actions-menu .actions-dropdown{left:50%;transform:translate(-50%);right:auto}}\n"], dependencies: [{ kind: "directive", type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i9$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i9$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i9$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
4796
4783
|
}
|
|
4797
4784
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DocumentSearchComponent, decorators: [{
|
|
4798
4785
|
type: Component,
|
|
4799
|
-
args: [{ selector: 'document-search', standalone: false, template: "<div class=\"search-container\">\r\n <div class=\"search-header\">\r\n <h2 class=\"ml-3 document-heading\">Documents</h2> \r\n </div>\r\n <div class=\"search-input-wrapper\">\r\n <i class=\"pi pi-search search-icon\"></i
|
|
4786
|
+
args: [{ selector: 'document-search', standalone: false, template: "<div class=\"search-container\">\r\n <div class=\"search-header\">\r\n <h2 class=\"ml-3 document-heading\">Documents</h2> \r\n </div>\r\n <div class=\"search-input-wrapper\">\r\n <!-- <i class=\"pi pi-search search-icon\"></i> -->\r\n <input \r\n type=\"text\" \r\n [(ngModel)]=\"searchTerm\"\r\n (ngModelChange)=\"onSearchInputChange($event)\"\r\n class=\"search-input\"\r\n placeholder=\"Search by document name, category, type, status or applicant name...\"\r\n [attr.aria-label]=\"'Search documents'\"\r\n />\r\n <button \r\n *ngIf=\"searchTerm\"\r\n type=\"button\"\r\n class=\"clear-button\"\r\n (click)=\"onClearSearch()\"\r\n [attr.aria-label]=\"'Clear search'\"\r\n >\r\n <i class=\"pi pi-times\"></i>\r\n </button>\r\n </div>\r\n\r\n <button \r\n *ngIf=\"shouldShowClearAll\"\r\n type=\"button\"\r\n class=\"clear-all-filters-link\"\r\n (click)=\"onClearAllFilters()\"\r\n [attr.aria-label]=\"'Clear all'\"\r\n >\r\n Clear All\r\n <i class=\"pi pi-times\"></i>\r\n </button>\r\n\r\n <div class=\"filters-section\">\r\n <div class=\"actions-menu\">\r\n <button \r\n type=\"button\"\r\n class=\"actions-btn\" \r\n (click)=\"toggleActionsMenu()\" \r\n [class.active]=\"showActionsMenu\"\r\n [attr.aria-label]=\"'Open actions menu'\"\r\n [attr.aria-expanded]=\"showActionsMenu\"\r\n >\r\n Actions\r\n <i class=\"pi pi-chevron-down\" [class.rotated]=\"showActionsMenu\"></i>\r\n </button>\r\n\r\n <!-- Actions Dropdown Menu -->\r\n <div class=\"actions-dropdown\" *ngIf=\"showActionsMenu\">\r\n <div class=\"dropdown-item\" (click)=\"handleUploadDocument()\">\r\n <i class=\"pi pi-upload\"></i>\r\n <span>Upload Document</span>\r\n </div>\r\n <div class=\"dropdown-item\" (click)=\"handleRequestDocument()\">\r\n <i class=\"pi pi-file\"></i>\r\n <span>Request Document</span>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n</div> ", styles: [".search-container{display:flex;align-items:center;gap:1rem;width:100%;justify-content:flex-start;padding:10px}.search-input-wrapper{position:relative;flex:1;display:flex;align-items:center;max-width:50%;min-width:300px}.clear-all-filters-link{background:none;border:none;color:#0f8bfd;cursor:pointer;padding:8px 12px;border-radius:4px;font-size:16px;font-weight:500;text-decoration:none!important;transition:background-color .2s ease,color .2s ease;white-space:nowrap;flex-shrink:0;display:flex;justify-content:center;align-items:center;gap:4px}.filters-section{display:flex;align-items:center;gap:1rem;flex-shrink:0;margin-left:auto}.filters-section .actions-menu{position:relative}.filters-section .actions-menu .actions-btn{background:#0f8bfd;border:none;border-radius:8px;padding:8px 10px;color:#fff;font-size:12px;font-weight:700;cursor:pointer;display:flex;align-items:center;gap:.5rem;transition:all .2s ease;white-space:nowrap}.filters-section .actions-menu .actions-btn:hover{background:#0d7ae6;transform:translateY(-1px)}.filters-section .actions-menu .actions-btn:active{transform:translateY(0)}.filters-section .actions-menu .actions-btn.active{background:#0d7ae6}.filters-section .actions-menu .actions-btn:focus{outline:none;box-shadow:0 0 0 3px #0f8bfd4d}.filters-section .actions-menu .actions-btn i{font-size:.75rem;transition:transform .2s}.filters-section .actions-menu .actions-btn i.rotated{transform:rotate(180deg)}.filters-section .actions-menu .actions-dropdown{position:absolute;top:calc(100% + .5rem);right:0;background:#fff;border:1px solid #d1d5db;border-radius:8px;box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f;z-index:1000;min-width:200px;overflow:hidden}.filters-section .actions-menu .actions-dropdown .dropdown-item{padding:.75rem 1rem;cursor:pointer;color:#374151;font-size:.875rem;transition:background-color .2s;display:flex;align-items:center;gap:.75rem}.filters-section .actions-menu .actions-dropdown .dropdown-item i{font-size:1rem;color:#6b7280}.filters-section .actions-menu .actions-dropdown .dropdown-item:hover{background-color:#f3f4f6}.filters-section .actions-menu .actions-dropdown .dropdown-item:not(:last-child){border-bottom:1px solid #f3f4f6}.filters-section .actions-menu .actions-dropdown .dropdown-item:active{background-color:#e5e7eb}.search-icon{position:absolute;left:12px;color:#6c757d;z-index:1}.search-input{width:100%;padding:10px 12px;border:1px solid #dee2e6;border-radius:8px;font-size:14px;outline:none;transition:border-color .2s ease,box-shadow .2s ease}.search-input:focus{border-color:#0f8bfd;box-shadow:0 0 0 3px #0f8bfd1a}.search-input::placeholder{color:#6c757d}.clear-button{position:absolute;right:12px;background:none;border:none;color:#6c757d;cursor:pointer;padding:4px;border-radius:4px;transition:background-color .2s ease,color .2s ease}.clear-button:hover{background-color:#f8f9fa;color:#495057}@media (max-width: 768px){.search-container{flex-direction:column;gap:.75rem}.search-input-wrapper{max-width:100%}.filters-section{width:100%;justify-content:center;gap:.5rem}.filters-section .actions-menu .actions-btn{width:auto;justify-content:center}.filters-section .actions-menu .actions-dropdown{left:50%;transform:translate(-50%);right:auto}}\n"] }]
|
|
4800
4787
|
}], ctorParameters: () => [{ type: DocumentHelperService }, { type: DocumentQuery }], propDecorators: { contextId: [{
|
|
4801
4788
|
type: Input
|
|
4802
4789
|
}], onActionClick: [{
|
|
@@ -5700,70 +5687,86 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
5700
5687
|
}]
|
|
5701
5688
|
}], ctorParameters: () => [{ type: DocumentUploadService }, { type: DocumentHttpService }, { type: DocumentQuery }, { type: DocumentStore }, { type: DocumentTableBuilderService }, { type: DocumentHelperService }] });
|
|
5702
5689
|
|
|
5690
|
+
/**
|
|
5691
|
+
* Service to observe section visibility and scroll state; deselects menu item when section scrolls out of view.
|
|
5692
|
+
*/
|
|
5703
5693
|
class DocumentScrollService {
|
|
5704
5694
|
documentStore;
|
|
5705
5695
|
sectionObserver = null;
|
|
5706
5696
|
currentObservedSection = null;
|
|
5707
5697
|
isScrolling = false;
|
|
5698
|
+
/** @type {(() => void) | null} */
|
|
5708
5699
|
scrollHandler = null;
|
|
5709
5700
|
scrollTimeout = null;
|
|
5701
|
+
/** Pending deselect scheduled on ratio=0. Cancelled when ratio>0 so we don't deselect after a stale ratio=0. */
|
|
5702
|
+
deselectTimeoutId = null;
|
|
5710
5703
|
constructor(documentStore) {
|
|
5711
5704
|
this.documentStore = documentStore;
|
|
5712
5705
|
}
|
|
5713
5706
|
/**
|
|
5714
|
-
* Sets up scroll event listeners to track scrolling state
|
|
5715
|
-
* @param containerElement - The container element to monitor for scroll events
|
|
5707
|
+
* Sets up scroll event listeners to track scrolling state.
|
|
5708
|
+
* @param {HTMLElement} containerElement - The container element to monitor for scroll events
|
|
5716
5709
|
*/
|
|
5717
5710
|
setupScrollListeners(containerElement) {
|
|
5718
5711
|
if (containerElement) {
|
|
5712
|
+
/** Scroll handler: sets isScrolling and resets after 150ms */
|
|
5719
5713
|
this.scrollHandler = () => {
|
|
5720
5714
|
this.isScrolling = true;
|
|
5721
|
-
if (this.scrollTimeout)
|
|
5715
|
+
if (this.scrollTimeout)
|
|
5722
5716
|
clearTimeout(this.scrollTimeout);
|
|
5723
|
-
}
|
|
5724
|
-
this.scrollTimeout = setTimeout(() => {
|
|
5725
|
-
this.isScrolling = false;
|
|
5726
|
-
}, 150);
|
|
5717
|
+
this.scrollTimeout = setTimeout(() => { this.isScrolling = false; }, 150);
|
|
5727
5718
|
};
|
|
5728
5719
|
containerElement.addEventListener('scroll', this.scrollHandler);
|
|
5729
5720
|
}
|
|
5730
5721
|
}
|
|
5731
5722
|
/**
|
|
5732
|
-
* Sets up intersection observer to
|
|
5733
|
-
* @param sectionElement - The section element to observe
|
|
5734
|
-
* @param menuItemId - The ID of the selected menu item
|
|
5723
|
+
* Sets up intersection observer to deselect when the selected section scrolls out of view.
|
|
5724
|
+
* @param {Element} sectionElement - The section element to observe
|
|
5725
|
+
* @param {string} menuItemId - The ID of the selected menu item
|
|
5735
5726
|
*/
|
|
5736
5727
|
setupSectionObserver(sectionElement, menuItemId) {
|
|
5728
|
+
this.cancelPendingDeselect();
|
|
5737
5729
|
this.disconnectSectionObserver();
|
|
5738
5730
|
setTimeout(() => {
|
|
5739
|
-
if (!menuItemId || this.isScrolling)
|
|
5731
|
+
if (!menuItemId || this.isScrolling)
|
|
5740
5732
|
return;
|
|
5741
|
-
}
|
|
5742
|
-
this.sectionObserver = new IntersectionObserver((entries) => {
|
|
5743
|
-
entries.forEach(entry => {
|
|
5744
|
-
if (entry.intersectionRatio === 0) {
|
|
5745
|
-
setTimeout(() => {
|
|
5746
|
-
if (this.sectionObserver && menuItemId && entry.intersectionRatio === 0) {
|
|
5747
|
-
this.documentStore.setSelectedMenuItem(null);
|
|
5748
|
-
this.disconnectSectionObserver();
|
|
5749
|
-
}
|
|
5750
|
-
}, 200);
|
|
5751
|
-
}
|
|
5752
|
-
});
|
|
5753
|
-
}, {
|
|
5754
|
-
threshold: [0, 0.1, 0.5, 1],
|
|
5755
|
-
rootMargin: '0px'
|
|
5756
|
-
});
|
|
5757
|
-
// Always start observing regardless of current visibility
|
|
5758
|
-
// The IntersectionObserver will handle visibility changes automatically
|
|
5733
|
+
this.sectionObserver = new IntersectionObserver((entries) => this.handleIntersectionEntries(entries, menuItemId), { threshold: [0, 0.1, 0.5, 1], rootMargin: '0px' });
|
|
5759
5734
|
this.sectionObserver.observe(sectionElement);
|
|
5760
5735
|
this.currentObservedSection = sectionElement;
|
|
5761
5736
|
}, 1200);
|
|
5762
5737
|
}
|
|
5738
|
+
/**
|
|
5739
|
+
* Handles IntersectionObserver entries: cancel pending deselect when visible, schedule deselect when ratio=0.
|
|
5740
|
+
* @param {IntersectionObserverEntry[]} entries - Observer entries
|
|
5741
|
+
* @param {string} menuItemId - Selected menu item id
|
|
5742
|
+
*/
|
|
5743
|
+
handleIntersectionEntries(entries, menuItemId) {
|
|
5744
|
+
entries.forEach(entry => {
|
|
5745
|
+
const ratio = entry.intersectionRatio;
|
|
5746
|
+
if (ratio > 0)
|
|
5747
|
+
this.cancelPendingDeselect();
|
|
5748
|
+
if (ratio === 0) {
|
|
5749
|
+
this.cancelPendingDeselect();
|
|
5750
|
+
this.deselectTimeoutId = setTimeout(() => {
|
|
5751
|
+
this.deselectTimeoutId = null;
|
|
5752
|
+
if (this.sectionObserver && menuItemId)
|
|
5753
|
+
this.documentStore.setSelectedMenuItem(null);
|
|
5754
|
+
this.disconnectSectionObserver();
|
|
5755
|
+
}, 200);
|
|
5756
|
+
}
|
|
5757
|
+
});
|
|
5758
|
+
}
|
|
5759
|
+
cancelPendingDeselect() {
|
|
5760
|
+
if (this.deselectTimeoutId != null) {
|
|
5761
|
+
clearTimeout(this.deselectTimeoutId);
|
|
5762
|
+
this.deselectTimeoutId = null;
|
|
5763
|
+
}
|
|
5764
|
+
}
|
|
5763
5765
|
/**
|
|
5764
5766
|
* Disconnects the section observer
|
|
5765
5767
|
*/
|
|
5766
5768
|
disconnectSectionObserver() {
|
|
5769
|
+
this.cancelPendingDeselect();
|
|
5767
5770
|
if (this.sectionObserver) {
|
|
5768
5771
|
this.sectionObserver.disconnect();
|
|
5769
5772
|
this.sectionObserver = null;
|
|
@@ -5777,8 +5780,8 @@ class DocumentScrollService {
|
|
|
5777
5780
|
this.isScrolling = true;
|
|
5778
5781
|
}
|
|
5779
5782
|
/**
|
|
5780
|
-
* Resets the scrolling flag after a specified delay
|
|
5781
|
-
* @param delay - Delay in milliseconds before resetting the flag
|
|
5783
|
+
* Resets the scrolling flag after a specified delay.
|
|
5784
|
+
* @param {number} [delay=1200] - Delay in milliseconds before resetting the flag
|
|
5782
5785
|
*/
|
|
5783
5786
|
resetScrollingAfterDelay(delay = 1200) {
|
|
5784
5787
|
setTimeout(() => {
|
|
@@ -5786,7 +5789,8 @@ class DocumentScrollService {
|
|
|
5786
5789
|
}, delay);
|
|
5787
5790
|
}
|
|
5788
5791
|
/**
|
|
5789
|
-
* Gets the current scrolling state
|
|
5792
|
+
* Gets the current scrolling state.
|
|
5793
|
+
* @returns {boolean} True when a scroll is in progress
|
|
5790
5794
|
*/
|
|
5791
5795
|
get isCurrentlyScrolling() {
|
|
5792
5796
|
return this.isScrolling;
|
|
@@ -5799,8 +5803,8 @@ class DocumentScrollService {
|
|
|
5799
5803
|
this.cleanupScrollListeners();
|
|
5800
5804
|
}
|
|
5801
5805
|
/**
|
|
5802
|
-
* Removes scroll event listeners
|
|
5803
|
-
* @param containerElement - The container element to remove listeners from
|
|
5806
|
+
* Removes scroll event listeners.
|
|
5807
|
+
* @param {HTMLElement} [containerElement] - The container element to remove listeners from
|
|
5804
5808
|
*/
|
|
5805
5809
|
cleanupScrollListeners(containerElement) {
|
|
5806
5810
|
if (containerElement && this.scrollHandler) {
|