cloud-ide-element 1.0.57 → 1.0.58
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.
|
@@ -3151,7 +3151,7 @@ class CideEleFileInputComponent {
|
|
|
3151
3151
|
return Math.round(this.uploadProgress() ** 1); // Simple power operation
|
|
3152
3152
|
}, ...(ngDevMode ? [{ debugName: "uploadProgressPercentage" }] : []));
|
|
3153
3153
|
// ControlValueAccessor callbacks
|
|
3154
|
-
onChange = (
|
|
3154
|
+
onChange = (value) => { };
|
|
3155
3155
|
onTouched = () => { };
|
|
3156
3156
|
onValidatorChange = () => { };
|
|
3157
3157
|
// Computed values
|
|
@@ -3175,11 +3175,29 @@ class CideEleFileInputComponent {
|
|
|
3175
3175
|
console.log('🎯 [FileInput] Component rendered and DOM is ready');
|
|
3176
3176
|
});
|
|
3177
3177
|
}
|
|
3178
|
-
writeValue(
|
|
3179
|
-
console.log('📝 [FileInput] writeValue called with:',
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3178
|
+
writeValue(value) {
|
|
3179
|
+
console.log('📝 [FileInput] writeValue called with:', value);
|
|
3180
|
+
if (typeof value === 'string') {
|
|
3181
|
+
// Value is an uploaded file ID
|
|
3182
|
+
console.log('📝 [FileInput] Value is uploaded file ID:', value);
|
|
3183
|
+
this.files.set(null);
|
|
3184
|
+
this.fileNames.set([]);
|
|
3185
|
+
this.clearPreviews();
|
|
3186
|
+
}
|
|
3187
|
+
else if (value instanceof FileList) {
|
|
3188
|
+
// Value is a FileList
|
|
3189
|
+
console.log('📝 [FileInput] Value is FileList:', Array.from(value).map(f => f.name));
|
|
3190
|
+
this.files.set(value);
|
|
3191
|
+
this.fileNames.set(Array.from(value).map(f => f.name));
|
|
3192
|
+
this.generatePreviews();
|
|
3193
|
+
}
|
|
3194
|
+
else {
|
|
3195
|
+
// Value is null
|
|
3196
|
+
console.log('📝 [FileInput] Value is null');
|
|
3197
|
+
this.files.set(null);
|
|
3198
|
+
this.fileNames.set([]);
|
|
3199
|
+
this.clearPreviews();
|
|
3200
|
+
}
|
|
3183
3201
|
}
|
|
3184
3202
|
registerOnChange(fn) {
|
|
3185
3203
|
this.onChange = fn;
|
|
@@ -3209,7 +3227,6 @@ class CideEleFileInputComponent {
|
|
|
3209
3227
|
this.onChange(selectedFiles);
|
|
3210
3228
|
this.fileChange.emit(selectedFiles);
|
|
3211
3229
|
this.onTouched();
|
|
3212
|
-
this.onValidatorChange();
|
|
3213
3230
|
// Auto upload if enabled
|
|
3214
3231
|
if (this.autoUpload() && selectedFiles && selectedFiles.length > 0) {
|
|
3215
3232
|
console.log('🚀 [FileInput] Auto upload enabled, starting upload for:', selectedFiles[0].name);
|
|
@@ -3228,7 +3245,6 @@ class CideEleFileInputComponent {
|
|
|
3228
3245
|
console.log('🔄 [FileInput] Upload status reset to:', this.uploadStatus());
|
|
3229
3246
|
this.onChange(null);
|
|
3230
3247
|
this.fileChange.emit(null);
|
|
3231
|
-
this.onValidatorChange();
|
|
3232
3248
|
}
|
|
3233
3249
|
uploadFile(file) {
|
|
3234
3250
|
console.log('📤 [FileInput] uploadFile called for:', file.name, 'Size:', file.size, 'bytes');
|
|
@@ -3238,9 +3254,6 @@ class CideEleFileInputComponent {
|
|
|
3238
3254
|
// Set upload status to 'start' before starting upload
|
|
3239
3255
|
this.uploadStatus.set('start');
|
|
3240
3256
|
console.log('🔄 [FileInput] Upload status set to:', this.uploadStatus());
|
|
3241
|
-
// Trigger validation update to show upload in progress error
|
|
3242
|
-
this.onValidatorChange();
|
|
3243
|
-
console.log('✅ [FileInput] Validation triggered - should show upload in progress error');
|
|
3244
3257
|
this.isUploading.set(true);
|
|
3245
3258
|
this.uploadProgress.set(0);
|
|
3246
3259
|
this.uploadProgressChange.emit(0);
|
|
@@ -3261,8 +3274,6 @@ class CideEleFileInputComponent {
|
|
|
3261
3274
|
if (this.uploadStatus() === 'start') {
|
|
3262
3275
|
this.uploadStatus.set('uploading');
|
|
3263
3276
|
console.log('🔄 [FileInput] Upload status changed to:', this.uploadStatus());
|
|
3264
|
-
this.onValidatorChange();
|
|
3265
|
-
console.log('✅ [FileInput] Validation triggered after status change to uploading');
|
|
3266
3277
|
}
|
|
3267
3278
|
// Update progress notification with spinner
|
|
3268
3279
|
const notificationId = this.uploadNotificationId();
|
|
@@ -3313,8 +3324,10 @@ class CideEleFileInputComponent {
|
|
|
3313
3324
|
const uploadedId = response?.data?.core_file_manager?.[0]?.cyfm_id;
|
|
3314
3325
|
if (uploadedId) {
|
|
3315
3326
|
console.log('✅ [FileInput] File uploaded successfully with ID:', uploadedId);
|
|
3327
|
+
// Set the uploaded ID as the form control value
|
|
3328
|
+
this.onChange(uploadedId);
|
|
3329
|
+
console.log('📝 [FileInput] Form control value set to uploaded ID:', uploadedId);
|
|
3316
3330
|
this.uploadSuccess.emit(uploadedId);
|
|
3317
|
-
// Note: Form control value remains as FileList - uploaded ID is emitted separately
|
|
3318
3331
|
console.log('📝 [FileInput] Upload success event emitted with file ID:', uploadedId);
|
|
3319
3332
|
}
|
|
3320
3333
|
else {
|
|
@@ -3323,9 +3336,6 @@ class CideEleFileInputComponent {
|
|
|
3323
3336
|
}
|
|
3324
3337
|
this.isUploading.set(false);
|
|
3325
3338
|
console.log('🔄 [FileInput] isUploading set to false');
|
|
3326
|
-
// Trigger validation update to clear upload in progress error
|
|
3327
|
-
this.onValidatorChange();
|
|
3328
|
-
console.log('✅ [FileInput] Validation triggered - should clear upload in progress error');
|
|
3329
3339
|
},
|
|
3330
3340
|
error: (error) => {
|
|
3331
3341
|
console.error('💥 [FileInput] Upload FAILED:', error);
|
|
@@ -3348,9 +3358,6 @@ class CideEleFileInputComponent {
|
|
|
3348
3358
|
this.uploadProgress.set(0);
|
|
3349
3359
|
this.uploadProgressChange.emit(0);
|
|
3350
3360
|
console.log('🔄 [FileInput] Upload state reset - isUploading: false, progress: 0%');
|
|
3351
|
-
// Trigger validation update to clear upload in progress error
|
|
3352
|
-
this.onValidatorChange();
|
|
3353
|
-
console.log('✅ [FileInput] Validation triggered - should clear upload in progress error');
|
|
3354
3361
|
}
|
|
3355
3362
|
});
|
|
3356
3363
|
}
|
|
@@ -3506,7 +3513,6 @@ class CideEleFileInputComponent {
|
|
|
3506
3513
|
this.onChange(files);
|
|
3507
3514
|
this.fileChange.emit(files);
|
|
3508
3515
|
this.onTouched();
|
|
3509
|
-
this.onValidatorChange();
|
|
3510
3516
|
// Auto upload if enabled
|
|
3511
3517
|
if (this.autoUpload() && files.length > 0) {
|
|
3512
3518
|
console.log('🚀 [FileInput] Auto upload enabled, starting upload for:', files[0].name);
|