cat-documents-ng 0.3.9 → 0.3.11
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.
|
@@ -242,6 +242,8 @@ export declare class SHARED {
|
|
|
242
242
|
static DOCUMENT_DELETED_SUCCESSFULLY: string;
|
|
243
243
|
static UNSAVED_CHANGES_ICON: string;
|
|
244
244
|
static REMOVE: string;
|
|
245
|
+
static YES: string;
|
|
246
|
+
static NO: string;
|
|
245
247
|
static CANCEL: string;
|
|
246
248
|
static ACCEPT_ICON: string;
|
|
247
249
|
static REJECT_ICON: string;
|
|
@@ -297,11 +297,13 @@ class SHARED {
|
|
|
297
297
|
static USER_LIST = 'userList';
|
|
298
298
|
static HYPEN = '-';
|
|
299
299
|
static CATEGORIES = 'categories';
|
|
300
|
-
static UNSAVED_CHANGES_MESSAGE = 'You
|
|
300
|
+
static UNSAVED_CHANGES_MESSAGE = 'You have unsaved changes. Are you sure you want to leave?';
|
|
301
301
|
static UNSAVED_CHANGES_HEADER = 'Unsaved Changes';
|
|
302
302
|
static DOCUMENT_DELETED_SUCCESSFULLY = 'Document deleted successfully';
|
|
303
303
|
static UNSAVED_CHANGES_ICON = 'pi pi-exclamation-triangle';
|
|
304
304
|
static REMOVE = 'Remove';
|
|
305
|
+
static YES = 'Yes';
|
|
306
|
+
static NO = 'No';
|
|
305
307
|
static CANCEL = 'Cancel';
|
|
306
308
|
static ACCEPT_ICON = 'pi pi-times';
|
|
307
309
|
static REJECT_ICON = 'pi pi-check';
|
|
@@ -3542,8 +3544,8 @@ class ConfirmationDialogComponent {
|
|
|
3542
3544
|
confirmationService;
|
|
3543
3545
|
confirmationOptions = {
|
|
3544
3546
|
message: 'Are you sure that you want to proceed?',
|
|
3545
|
-
header: '
|
|
3546
|
-
icon: '
|
|
3547
|
+
header: '',
|
|
3548
|
+
icon: '',
|
|
3547
3549
|
acceptLabel: 'Yes',
|
|
3548
3550
|
rejectLabel: 'No',
|
|
3549
3551
|
acceptIcon: 'pi pi-check',
|
|
@@ -3584,8 +3586,8 @@ class ConfirmationDialogComponent {
|
|
|
3584
3586
|
static confirm(confirmationService, options, acceptCallback, rejectCallback) {
|
|
3585
3587
|
const defaultOptions = {
|
|
3586
3588
|
message: 'Are you sure that you want to proceed?',
|
|
3587
|
-
header: '
|
|
3588
|
-
icon: '
|
|
3589
|
+
header: '',
|
|
3590
|
+
icon: '',
|
|
3589
3591
|
acceptLabel: 'Yes',
|
|
3590
3592
|
rejectLabel: 'No',
|
|
3591
3593
|
acceptIcon: 'pi pi-check',
|
|
@@ -3673,13 +3675,10 @@ class SidebarComponent {
|
|
|
3673
3675
|
showSuccessMessage = false;
|
|
3674
3676
|
showErrorMessage = false;
|
|
3675
3677
|
destroy$ = new Subject();
|
|
3676
|
-
// Confirmation options for unsaved changes
|
|
3677
3678
|
unsavedChangesConfirmationOptions = {
|
|
3678
3679
|
message: SHARED.UNSAVED_CHANGES_MESSAGE,
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
acceptLabel: SHARED.REMOVE,
|
|
3682
|
-
rejectLabel: SHARED.CANCEL,
|
|
3680
|
+
acceptLabel: SHARED.YES,
|
|
3681
|
+
rejectLabel: SHARED.NO,
|
|
3683
3682
|
acceptIcon: SHARED.ACCEPT_ICON,
|
|
3684
3683
|
rejectIcon: SHARED.REJECT_ICON,
|
|
3685
3684
|
acceptButtonClass: SHARED.ACCEPT_BUTTON_STYLE_CLASS,
|
|
@@ -3693,7 +3692,6 @@ class SidebarComponent {
|
|
|
3693
3692
|
* Only emits when actually closing, not when showing confirmation
|
|
3694
3693
|
*/
|
|
3695
3694
|
onSidebarHide() {
|
|
3696
|
-
// Only emit onHide if we're not showing confirmation
|
|
3697
3695
|
if (!this.isShowingConfirmation) {
|
|
3698
3696
|
this.onHide.emit();
|
|
3699
3697
|
}
|
|
@@ -3703,9 +3701,7 @@ class SidebarComponent {
|
|
|
3703
3701
|
* Intercepts automatic closing to show confirmation if needed
|
|
3704
3702
|
*/
|
|
3705
3703
|
onVisibleChange(value) {
|
|
3706
|
-
// If PrimeNG is trying to close the sidebar and we have unsaved changes
|
|
3707
3704
|
if (!value && this.hasUnsavedChanges && !this.isShowingConfirmation) {
|
|
3708
|
-
// Prevent the close and show confirmation
|
|
3709
3705
|
this._visible = true;
|
|
3710
3706
|
this.showUnsavedChangesConfirmation();
|
|
3711
3707
|
return;
|
|
@@ -3766,13 +3762,13 @@ class SidebarComponent {
|
|
|
3766
3762
|
*/
|
|
3767
3763
|
showUnsavedChangesConfirmation() {
|
|
3768
3764
|
if (this.isShowingConfirmation) {
|
|
3769
|
-
return;
|
|
3765
|
+
return;
|
|
3770
3766
|
}
|
|
3771
3767
|
this.isShowingConfirmation = true;
|
|
3772
3768
|
ConfirmationDialogComponent.confirm(this.confirmationService, this.unsavedChangesConfirmationOptions, () => {
|
|
3773
3769
|
this.isShowingConfirmation = false;
|
|
3774
3770
|
this.close();
|
|
3775
|
-
this.onClose.emit();
|
|
3771
|
+
this.onClose.emit();
|
|
3776
3772
|
}, () => {
|
|
3777
3773
|
this.isShowingConfirmation = false;
|
|
3778
3774
|
});
|
|
@@ -4544,23 +4540,12 @@ class DocumentTableBuilderService {
|
|
|
4544
4540
|
* @returns TableData object
|
|
4545
4541
|
*/
|
|
4546
4542
|
buildDocumentTable(documents) {
|
|
4547
|
-
console.log('Building document table with documents:', documents);
|
|
4548
4543
|
const columns = SHARED.DOCUMENT_TABLE_COLUMNS.filter(col => col.type !== SHARED.ACTIONS);
|
|
4549
4544
|
// Format document names to include aliasName if available
|
|
4550
|
-
const formattedDocuments = documents.map(doc => {
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
hasAliasName: !!doc.aliasName,
|
|
4555
|
-
aliasNameTrimmed: doc.aliasName?.trim(),
|
|
4556
|
-
aliasNameEmpty: doc.aliasName === SHARED.EMPTY
|
|
4557
|
-
});
|
|
4558
|
-
return {
|
|
4559
|
-
...doc,
|
|
4560
|
-
docName: this.formatDocumentDisplayName(doc.docName, doc.aliasName)
|
|
4561
|
-
};
|
|
4562
|
-
});
|
|
4563
|
-
console.log('Formatted documents:', formattedDocuments);
|
|
4545
|
+
const formattedDocuments = documents.map(doc => ({
|
|
4546
|
+
...doc,
|
|
4547
|
+
docName: this.formatDocumentDisplayName(doc.docName, doc.aliasName)
|
|
4548
|
+
}));
|
|
4564
4549
|
return {
|
|
4565
4550
|
columns: columns,
|
|
4566
4551
|
data: formattedDocuments
|
|
@@ -4573,17 +4558,10 @@ class DocumentTableBuilderService {
|
|
|
4573
4558
|
* @returns Formatted display name
|
|
4574
4559
|
*/
|
|
4575
4560
|
formatDocumentDisplayName(docName, aliasName) {
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
aliasName !== SHARED.EMPTY &&
|
|
4581
|
-
aliasName.trim() !== docName.replace(/\.[^/.]+$/, '')) { // Remove file extension for comparison
|
|
4582
|
-
const formattedName = `${docName} - ${aliasName}`;
|
|
4583
|
-
console.log('Formatted name:', formattedName);
|
|
4584
|
-
return formattedName;
|
|
4585
|
-
}
|
|
4586
|
-
console.log('Using original name:', docName);
|
|
4561
|
+
// Show aliasName if it exists and is not empty
|
|
4562
|
+
if (aliasName && aliasName.trim() !== SHARED.EMPTY) {
|
|
4563
|
+
return `${docName} - ${aliasName}`;
|
|
4564
|
+
}
|
|
4587
4565
|
return docName;
|
|
4588
4566
|
}
|
|
4589
4567
|
/**
|
|
@@ -4815,7 +4793,7 @@ class TablePrimaryComponent {
|
|
|
4815
4793
|
}
|
|
4816
4794
|
}
|
|
4817
4795
|
processTableData() {
|
|
4818
|
-
this.processedData = this.tableData.data.map(rowData => {
|
|
4796
|
+
this.processedData = this.tableData.data.map((rowData, index) => {
|
|
4819
4797
|
const processedRow = { ...rowData };
|
|
4820
4798
|
if (rowData.fileName) {
|
|
4821
4799
|
processedRow._fileExtension = this.getFileExtension(rowData.fileName);
|