cloud-ide-element 1.0.112 → 1.0.114
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.
|
@@ -2654,16 +2654,18 @@ class CideEleFileManagerService {
|
|
|
2654
2654
|
// Optimized computed properties for file counting by group
|
|
2655
2655
|
getFileCountByGroup = computed(() => {
|
|
2656
2656
|
const countMap = new Map();
|
|
2657
|
-
// Count
|
|
2657
|
+
// Count files for each group using the same deduplication logic as getAllFilesForGroup
|
|
2658
|
+
this._fetchedFiles().forEach((fetchedFiles, groupId) => {
|
|
2659
|
+
const fileCount = this.getAllFilesForGroup(groupId).length;
|
|
2660
|
+
countMap.set(groupId, fileCount);
|
|
2661
|
+
});
|
|
2662
|
+
// Also count groups that have active uploads but no fetched files yet
|
|
2658
2663
|
this._activeUploads().forEach((upload, fileId) => {
|
|
2659
|
-
if (upload.groupId) {
|
|
2660
|
-
|
|
2664
|
+
if (upload.groupId && !countMap.has(upload.groupId)) {
|
|
2665
|
+
const fileCount = this.getAllFilesForGroup(upload.groupId).length;
|
|
2666
|
+
countMap.set(upload.groupId, fileCount);
|
|
2661
2667
|
}
|
|
2662
2668
|
});
|
|
2663
|
-
// Add fetched files by group
|
|
2664
|
-
this._fetchedFiles().forEach((files, groupId) => {
|
|
2665
|
-
countMap.set(groupId, (countMap.get(groupId) || 0) + files.length);
|
|
2666
|
-
});
|
|
2667
2669
|
return countMap;
|
|
2668
2670
|
}, ...(ngDevMode ? [{ debugName: "getFileCountByGroup" }] : []));
|
|
2669
2671
|
serviceState = computed(() => ({
|
|
@@ -3731,12 +3733,22 @@ class CideEleFileInputComponent {
|
|
|
3731
3733
|
if (existingComponentGroupId) {
|
|
3732
3734
|
// Component already has its own group ID - use it
|
|
3733
3735
|
console.log('🆔 [FileInput] Using existing component group ID:', existingComponentGroupId);
|
|
3736
|
+
// Open floating uploader with existing group ID
|
|
3737
|
+
if (this.showFloatingUploaderSignal()) {
|
|
3738
|
+
console.log('🔄 [FileInput] Opening floating uploader with existing group ID:', existingComponentGroupId);
|
|
3739
|
+
this.fileManagerService.triggerFloatingUploaderShow(existingComponentGroupId);
|
|
3740
|
+
}
|
|
3734
3741
|
this.startMulti(files, existingComponentGroupId);
|
|
3735
3742
|
}
|
|
3736
3743
|
else if (existingUploadDataGroupId) {
|
|
3737
3744
|
// Use group ID from uploadData and set it as component's group ID
|
|
3738
3745
|
console.log('🆔 [FileInput] Using group ID from uploadData:', existingUploadDataGroupId);
|
|
3739
3746
|
this.groupId.set(existingUploadDataGroupId);
|
|
3747
|
+
// Open floating uploader with group ID from uploadData
|
|
3748
|
+
if (this.showFloatingUploaderSignal()) {
|
|
3749
|
+
console.log('🔄 [FileInput] Opening floating uploader with uploadData group ID:', existingUploadDataGroupId);
|
|
3750
|
+
this.fileManagerService.triggerFloatingUploaderShow(existingUploadDataGroupId);
|
|
3751
|
+
}
|
|
3740
3752
|
this.startMulti(files, existingUploadDataGroupId);
|
|
3741
3753
|
}
|
|
3742
3754
|
else {
|
|
@@ -3748,6 +3760,11 @@ class CideEleFileInputComponent {
|
|
|
3748
3760
|
console.log('🆔 [FileInput] Generated new group ID just before upload:', newGroupId);
|
|
3749
3761
|
// Set the group ID to this component so it can track its own files
|
|
3750
3762
|
this.groupId.set(newGroupId);
|
|
3763
|
+
// Open floating uploader with newly generated group ID
|
|
3764
|
+
if (this.showFloatingUploaderSignal()) {
|
|
3765
|
+
console.log('🔄 [FileInput] Opening floating uploader with new group ID:', newGroupId);
|
|
3766
|
+
this.fileManagerService.triggerFloatingUploaderShow(newGroupId);
|
|
3767
|
+
}
|
|
3751
3768
|
this.startMulti(files, newGroupId);
|
|
3752
3769
|
},
|
|
3753
3770
|
error: (error) => {
|
|
@@ -4038,13 +4055,13 @@ class CideEleFileInputComponent {
|
|
|
4038
4055
|
}
|
|
4039
4056
|
const groupId = this.groupId();
|
|
4040
4057
|
if (groupId) {
|
|
4041
|
-
console.log("
|
|
4058
|
+
console.log("✅ [FileInput] Has existing group ID:", groupId);
|
|
4042
4059
|
// Fetch files for the group and trigger floating uploader to show
|
|
4043
4060
|
this.fileManagerService.fetchAndStoreFilesByGroupId(groupId)
|
|
4044
4061
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
4045
4062
|
.subscribe({
|
|
4046
4063
|
next: (files) => {
|
|
4047
|
-
console.log('✅ [FileInput] Files fetched for floating uploader:
|
|
4064
|
+
console.log('✅ [FileInput] Files fetched for floating uploader:', files.length);
|
|
4048
4065
|
// Trigger the floating uploader to show via service with group ID
|
|
4049
4066
|
this.fileManagerService.triggerFloatingUploaderShow(groupId);
|
|
4050
4067
|
},
|
|
@@ -4056,8 +4073,10 @@ class CideEleFileInputComponent {
|
|
|
4056
4073
|
});
|
|
4057
4074
|
}
|
|
4058
4075
|
else {
|
|
4059
|
-
|
|
4060
|
-
|
|
4076
|
+
console.log('⚠️ [FileInput] No group ID yet - floating uploader will open when user uploads files');
|
|
4077
|
+
// No group ID yet - don't open floating uploader now
|
|
4078
|
+
// It will open automatically when user uploads files and group ID is generated
|
|
4079
|
+
// This prevents the "No active files" issue
|
|
4061
4080
|
}
|
|
4062
4081
|
}
|
|
4063
4082
|
/**
|
|
@@ -4460,19 +4479,29 @@ class CideEleFloatingFileUploaderComponent {
|
|
|
4460
4479
|
this.showWithAnimation();
|
|
4461
4480
|
return;
|
|
4462
4481
|
}
|
|
4463
|
-
//
|
|
4464
|
-
if (shouldShow
|
|
4482
|
+
// Handle manual trigger (show OR switch group ID)
|
|
4483
|
+
if (shouldShow) {
|
|
4465
4484
|
if (triggerGroupId) {
|
|
4485
|
+
// Always switch to the new group ID (even if already visible)
|
|
4486
|
+
console.log('🔄 [FloatingFileUploader] Switching to group ID:', triggerGroupId);
|
|
4466
4487
|
this.currentGroupId.set(triggerGroupId);
|
|
4467
4488
|
// Fetch files for this group
|
|
4468
4489
|
this.fileManagerService.fetchAndStoreFilesByGroupId(triggerGroupId)
|
|
4469
4490
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
4470
4491
|
.subscribe({
|
|
4471
|
-
next: () =>
|
|
4472
|
-
|
|
4492
|
+
next: () => {
|
|
4493
|
+
if (!isCurrentlyVisible) {
|
|
4494
|
+
this.showWithAnimation();
|
|
4495
|
+
}
|
|
4496
|
+
},
|
|
4497
|
+
error: () => {
|
|
4498
|
+
if (!isCurrentlyVisible) {
|
|
4499
|
+
this.showWithAnimation(); // Show anyway
|
|
4500
|
+
}
|
|
4501
|
+
}
|
|
4473
4502
|
});
|
|
4474
4503
|
}
|
|
4475
|
-
else {
|
|
4504
|
+
else if (!isCurrentlyVisible) {
|
|
4476
4505
|
this.showWithAnimation();
|
|
4477
4506
|
}
|
|
4478
4507
|
}
|
|
@@ -4586,8 +4615,8 @@ class CideEleFloatingFileUploaderComponent {
|
|
|
4586
4615
|
*/
|
|
4587
4616
|
handleFiles(files) {
|
|
4588
4617
|
console.log('📁 [FloatingFileUploader] Handling files:', files.length);
|
|
4589
|
-
// Use
|
|
4590
|
-
this.
|
|
4618
|
+
// Use handleFileSelection to avoid duplicate upload paths
|
|
4619
|
+
this.handleFileSelection(files);
|
|
4591
4620
|
}
|
|
4592
4621
|
/**
|
|
4593
4622
|
* Update visibility - simplified for notification only
|
|
@@ -4723,41 +4752,6 @@ class CideEleFloatingFileUploaderComponent {
|
|
|
4723
4752
|
this.currentUserId.set(userId);
|
|
4724
4753
|
this.fileManagerService.setUserId(userId);
|
|
4725
4754
|
}
|
|
4726
|
-
/**
|
|
4727
|
-
* Public method to handle files from external sources
|
|
4728
|
-
* This can be called by other components to trigger the floating uploader
|
|
4729
|
-
*/
|
|
4730
|
-
handleExternalFiles(files, userId, groupId) {
|
|
4731
|
-
console.log('📁 [FloatingFileUploader] External files received:', files.length, 'files');
|
|
4732
|
-
// Set user ID if provided
|
|
4733
|
-
if (userId && userId !== this.currentUserId()) {
|
|
4734
|
-
this.setCurrentUserId(userId);
|
|
4735
|
-
}
|
|
4736
|
-
// Set group ID if provided
|
|
4737
|
-
if (groupId) {
|
|
4738
|
-
this.currentGroupId.set(groupId);
|
|
4739
|
-
}
|
|
4740
|
-
// Upload files using file manager service
|
|
4741
|
-
// The file manager service will handle adding to its queue and the effect will show the floating uploader
|
|
4742
|
-
files.forEach((file, index) => {
|
|
4743
|
-
console.log(`📁 [FloatingFileUploader] Starting upload for file ${index + 1}/${files.length}:`, file.name);
|
|
4744
|
-
this.fileManagerService.uploadFile(file, {
|
|
4745
|
-
userId: this.currentUserId(),
|
|
4746
|
-
groupId: groupId,
|
|
4747
|
-
permissions: ['read', 'write'],
|
|
4748
|
-
tags: []
|
|
4749
|
-
})
|
|
4750
|
-
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
4751
|
-
.subscribe({
|
|
4752
|
-
next: (response) => {
|
|
4753
|
-
console.log('✅ [FloatingFileUploader] Upload completed:', response);
|
|
4754
|
-
},
|
|
4755
|
-
error: (error) => {
|
|
4756
|
-
console.error('❌ [FloatingFileUploader] Upload failed:', error);
|
|
4757
|
-
}
|
|
4758
|
-
});
|
|
4759
|
-
});
|
|
4760
|
-
}
|
|
4761
4755
|
/**
|
|
4762
4756
|
* Check if there are any uploads for the current group
|
|
4763
4757
|
*/
|
|
@@ -4803,7 +4797,8 @@ class CideEleFloatingFileUploaderComponent {
|
|
|
4803
4797
|
* Trigger file input click
|
|
4804
4798
|
*/
|
|
4805
4799
|
triggerFileInput() {
|
|
4806
|
-
|
|
4800
|
+
// Use ViewChild or querySelector with specific selector to target only this component's file input
|
|
4801
|
+
const fileInput = document.querySelector('.floating-uploader input[type="file"]');
|
|
4807
4802
|
if (fileInput) {
|
|
4808
4803
|
fileInput.click();
|
|
4809
4804
|
}
|