cloud-ide-element 1.0.70 β†’ 1.0.72

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.
@@ -3187,6 +3187,7 @@ class CideEleFileInputComponent {
3187
3187
  uploadNotificationId = signal(null, ...(ngDevMode ? [{ debugName: "uploadNotificationId" }] : []));
3188
3188
  isDragOver = signal(false, ...(ngDevMode ? [{ debugName: "isDragOver" }] : []));
3189
3189
  groupId = signal(null, ...(ngDevMode ? [{ debugName: "groupId" }] : [])); // Group ID for multiple file uploads
3190
+ isMultipleUploadMode = signal(false, ...(ngDevMode ? [{ debugName: "isMultipleUploadMode" }] : [])); // Flag to track if we're in multiple upload mode
3190
3191
  // Computed signals for better relationships
3191
3192
  hasFiles = computed(() => this.files() !== null && this.files().length > 0, ...(ngDevMode ? [{ debugName: "hasFiles" }] : []));
3192
3193
  canUpload = computed(() => this.hasFiles() && !this.isUploading() && !this.disabledSignal(), ...(ngDevMode ? [{ debugName: "canUpload" }] : []));
@@ -3341,12 +3342,12 @@ class CideEleFileInputComponent {
3341
3342
  this.onTouched();
3342
3343
  // Auto upload if enabled
3343
3344
  if (this.autoUploadSignal() && selectedFiles && selectedFiles.length > 0) {
3344
- if (this.multipleSignal() && selectedFiles.length > 1) {
3345
- console.log('πŸš€ [FileInput] Auto upload enabled for multiple files:', selectedFiles.length);
3345
+ if (this.multipleSignal()) {
3346
+ console.log('πŸš€ [FileInput] Auto upload enabled for multiple files mode:', selectedFiles.length, 'files');
3346
3347
  this.uploadMultipleFiles(Array.from(selectedFiles));
3347
3348
  }
3348
3349
  else {
3349
- console.log('πŸš€ [FileInput] Auto upload enabled, starting upload for:', selectedFiles[0].name);
3350
+ console.log('πŸš€ [FileInput] Auto upload enabled for single file mode:', selectedFiles[0].name);
3350
3351
  this.uploadFile(selectedFiles[0]);
3351
3352
  }
3352
3353
  }
@@ -3445,8 +3446,14 @@ class CideEleFileInputComponent {
3445
3446
  // Set the uploaded ID as the form control value
3446
3447
  this.onChange(uploadedId);
3447
3448
  console.log('πŸ“ [FileInput] Form control value set to uploaded ID:', uploadedId);
3448
- this.uploadSuccess.emit(uploadedId);
3449
- console.log('πŸ“ [FileInput] Upload success event emitted with file ID:', uploadedId);
3449
+ // Only emit individual uploadSuccess if not in multiple upload mode
3450
+ if (!this.isMultipleUploadMode()) {
3451
+ this.uploadSuccess.emit(uploadedId);
3452
+ console.log('πŸ“ [FileInput] Upload success event emitted with file ID:', uploadedId);
3453
+ }
3454
+ else {
3455
+ console.log('πŸ“ [FileInput] Individual upload success suppressed (multiple upload mode) - file ID:', uploadedId);
3456
+ }
3450
3457
  }
3451
3458
  else {
3452
3459
  console.error('❌ [FileInput] Upload successful but no ID returned:', response);
@@ -3481,10 +3488,13 @@ class CideEleFileInputComponent {
3481
3488
  }
3482
3489
  /**
3483
3490
  * Upload multiple files with group ID support
3484
- * Generates a group ID if not provided and uploads all files with the same group ID
3491
+ * FLOW: 1) Generate group ID first, 2) Upload all files with same group ID, 3) Emit group ID on completion
3485
3492
  */
3486
3493
  uploadMultipleFiles(files) {
3487
3494
  console.log('πŸ“€ [FileInput] uploadMultipleFiles called for:', files.length, 'files');
3495
+ console.log('πŸ”„ [FileInput] STEP 1: Generate group ID before starting any file uploads');
3496
+ // Set multiple upload mode flag
3497
+ this.isMultipleUploadMode.set(true);
3488
3498
  // Set upload status to 'start' before starting upload
3489
3499
  this.uploadStatus.set('start');
3490
3500
  this.isUploading.set(true);
@@ -3495,20 +3505,22 @@ class CideEleFileInputComponent {
3495
3505
  // Show initial progress notification
3496
3506
  const notificationId = this.notificationService.showProgress('πŸ”„ Preparing multiple file upload...', 0, { duration: 0 });
3497
3507
  this.uploadNotificationId.set(notificationId);
3498
- // Check if we already have a group ID from uploadData
3508
+ // STEP 1: Generate or get group ID BEFORE starting any file uploads
3499
3509
  const existingGroupId = this.uploadDataSignal().groupId;
3500
3510
  if (existingGroupId) {
3501
- console.log('πŸ†” [FileInput] Using existing group ID:', existingGroupId);
3511
+ console.log('πŸ†” [FileInput] STEP 1 COMPLETE: Using existing group ID:', existingGroupId);
3512
+ console.log('πŸ”„ [FileInput] STEP 2: Starting file uploads with group ID:', existingGroupId);
3502
3513
  this.groupId.set(existingGroupId);
3503
3514
  this.startMulti(files, existingGroupId);
3504
3515
  }
3505
3516
  else {
3506
- console.log('πŸ†” [FileInput] No group ID provided, generating new one...');
3507
- // Generate group ID first
3517
+ console.log('πŸ†” [FileInput] No existing group ID, generating new one...');
3518
+ // Generate group ID BEFORE starting any file uploads
3508
3519
  this.fileManagerService.generateObjectId().subscribe({
3509
3520
  next: (response) => {
3510
3521
  const newGroupId = response.objectId;
3511
- console.log('πŸ†” [FileInput] Generated new group ID:', newGroupId);
3522
+ console.log('πŸ†” [FileInput] STEP 1 COMPLETE: Generated new group ID:', newGroupId);
3523
+ console.log('πŸ”„ [FileInput] STEP 2: Starting file uploads with group ID:', newGroupId);
3512
3524
  this.groupId.set(newGroupId);
3513
3525
  this.startMulti(files, newGroupId);
3514
3526
  },
@@ -3529,18 +3541,21 @@ class CideEleFileInputComponent {
3529
3541
  }
3530
3542
  /**
3531
3543
  * Start uploading multiple files with the provided group ID
3544
+ * All files will be uploaded with the SAME group ID that was generated before this method
3532
3545
  */
3533
3546
  startMulti(files, groupId) {
3534
- console.log('πŸš€ [FileInput] Starting upload for', files.length, 'files with group ID:', groupId);
3547
+ console.log('πŸš€ [FileInput] STEP 2: Starting upload for', files.length, 'files with group ID:', groupId);
3548
+ console.log('πŸ“‹ [FileInput] All files will use the same group ID:', groupId);
3535
3549
  let completedUploads = 0;
3536
3550
  let failedUploads = 0;
3537
3551
  const totalFiles = files.length;
3538
- // Update upload data with group ID
3552
+ // IMPORTANT: All files use the SAME group ID that was generated before starting uploads
3539
3553
  const uploadDataWithGroupId = {
3540
3554
  ...this.uploadDataSignal(),
3541
3555
  groupId: groupId
3542
3556
  };
3543
3557
  files.forEach((file, index) => {
3558
+ console.log(`πŸ“€ [FileInput] Uploading file ${index + 1}/${totalFiles}: "${file.name}" with group ID: ${groupId}`);
3544
3559
  this.fileManagerService.uploadFile(file, uploadDataWithGroupId, (progress) => {
3545
3560
  // Calculate overall progress
3546
3561
  const fileProgress = progress / totalFiles;
@@ -3591,10 +3606,11 @@ class CideEleFileInputComponent {
3591
3606
  // All files uploaded successfully
3592
3607
  this.uploadStatus.set('success');
3593
3608
  this.notificationService.success(`βœ… All ${total} files uploaded successfully!`, { duration: 0 });
3594
- // For multiple file upload, return the group ID as the form value
3609
+ // STEP 3: For multiple file upload, emit the group ID (not individual file IDs)
3595
3610
  this.onChange(groupId);
3596
3611
  this.uploadSuccess.emit(groupId);
3597
- console.log('πŸ“ [FileInput] Form control value set to group ID:', groupId);
3612
+ console.log('πŸ“ [FileInput] STEP 3 COMPLETE: Form control value set to group ID:', groupId);
3613
+ console.log('βœ… [FileInput] Multiple upload SUCCESS - Group ID emitted:', groupId);
3598
3614
  }
3599
3615
  else if (completed > 0) {
3600
3616
  // Some files uploaded successfully
@@ -3608,6 +3624,8 @@ class CideEleFileInputComponent {
3608
3624
  this.notificationService.error(`❌ All ${total} files failed to upload.`, { duration: 0 });
3609
3625
  this.uploadError.emit('All files failed to upload');
3610
3626
  }
3627
+ // Reset multiple upload mode flag
3628
+ this.isMultipleUploadMode.set(false);
3611
3629
  }
3612
3630
  generatePreviews() {
3613
3631
  // Clear existing previews
@@ -3827,8 +3845,14 @@ class CideEleFileInputComponent {
3827
3845
  this.onTouched();
3828
3846
  // Auto upload if enabled
3829
3847
  if (this.autoUploadSignal() && files.length > 0) {
3830
- console.log('πŸš€ [FileInput] Auto upload enabled, starting upload for:', files[0].name);
3831
- this.uploadFile(files[0]);
3848
+ if (this.multipleSignal()) {
3849
+ console.log('πŸš€ [FileInput] Auto upload enabled for multiple files mode (drag & drop):', files.length, 'files');
3850
+ this.uploadMultipleFiles(Array.from(files));
3851
+ }
3852
+ else {
3853
+ console.log('πŸš€ [FileInput] Auto upload enabled for single file mode (drag & drop):', files[0].name);
3854
+ this.uploadFile(files[0]);
3855
+ }
3832
3856
  }
3833
3857
  else {
3834
3858
  console.log('⏸️ [FileInput] Auto upload disabled or no files');