cloud-ide-element 1.0.91 → 1.0.92

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.
@@ -3807,13 +3807,22 @@ class CideEleFileInputComponent {
3807
3807
  writeValue(value) {
3808
3808
  console.log('📝 [FileInput] writeValue called with:', value);
3809
3809
  if (typeof value === 'string') {
3810
- // Value is an uploaded file ID - fetch file details and set preview
3811
- console.log('📝 [FileInput] Value is uploaded file ID:', value);
3812
- this.files.set(null);
3813
- this.fileNames.set([]);
3814
- this.clearPreviews();
3815
- // Fetch file details to get base64 and set preview
3816
- this.loadFileDetailsFromId(value);
3810
+ // Check if this is a group ID for multiple files or single file ID
3811
+ if (this.isMultipleFileMode()) {
3812
+ // Multiple file mode - value is group ID
3813
+ console.log('📁 [FileInput] Value is group ID for multiple files:', value);
3814
+ this.groupId.set(value);
3815
+ this.loadFilesFromGroupId(value);
3816
+ }
3817
+ else {
3818
+ // Single file mode - value is file ID
3819
+ console.log('📝 [FileInput] Value is single file ID:', value);
3820
+ this.files.set(null);
3821
+ this.fileNames.set([]);
3822
+ this.clearPreviews();
3823
+ // Fetch file details to get base64 and set preview
3824
+ this.loadFileDetailsFromId(value);
3825
+ }
3817
3826
  }
3818
3827
  else if (value instanceof FileList) {
3819
3828
  // Value is a FileList
@@ -3821,6 +3830,14 @@ class CideEleFileInputComponent {
3821
3830
  this.files.set(value);
3822
3831
  this.fileNames.set(Array.from(value).map(f => f.name));
3823
3832
  this.generatePreviews();
3833
+ // For multiple files, use group ID API to fetch files
3834
+ if (value.length > 1) {
3835
+ const groupId = this.groupId();
3836
+ if (groupId) {
3837
+ console.log('📁 [FileInput] Multiple files detected, fetching files for group:', groupId);
3838
+ this.loadFilesFromGroupId(groupId);
3839
+ }
3840
+ }
3824
3841
  }
3825
3842
  else {
3826
3843
  // Value is null
@@ -4223,6 +4240,42 @@ class CideEleFileInputComponent {
4223
4240
  }
4224
4241
  });
4225
4242
  }
4243
+ /**
4244
+ * Check if the component is in multiple file mode
4245
+ */
4246
+ isMultipleFileMode() {
4247
+ // Check if multiple attribute is set or if we have a group ID
4248
+ return this.multiple || this.groupId() !== null;
4249
+ }
4250
+ /**
4251
+ * Load files from group ID using the group API
4252
+ */
4253
+ loadFilesFromGroupId(groupId) {
4254
+ console.log('🔍 [FileInput] Loading files for group ID:', groupId);
4255
+ if (!groupId)
4256
+ return;
4257
+ this.fileManagerService.fetchAndStoreFilesByGroupId(groupId)
4258
+ .pipe(takeUntilDestroyed(this.destroyRef))
4259
+ .subscribe({
4260
+ next: (files) => {
4261
+ console.log('📋 [FileInput] Files loaded for group:', files.length);
4262
+ // Set file names to show count in input
4263
+ if (files && files.length > 0) {
4264
+ const fileNames = files.map(file => file.file_name || file.name || 'Unknown file');
4265
+ this.fileNames.set(fileNames);
4266
+ console.log('📝 [FileInput] File names set for display:', fileNames);
4267
+ }
4268
+ else {
4269
+ this.fileNames.set([]);
4270
+ }
4271
+ // Files are now stored in service state and will be displayed by floating uploader
4272
+ },
4273
+ error: (error) => {
4274
+ console.error('❌ [FileInput] Failed to load files for group:', error);
4275
+ this.fileNames.set([]);
4276
+ }
4277
+ });
4278
+ }
4226
4279
  isImageFileFromName(fileName) {
4227
4280
  if (!fileName)
4228
4281
  return false;