@bnsights/bbsf-controls 1.0.194-beta.19-8 → 1.0.194-beta.19-10

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.
@@ -7177,6 +7177,11 @@ class FileUploadComponent {
7177
7177
  this.acceptedTypeArray = this.acceptedTypeArray.filter((value) => value.trim() != '');
7178
7178
  // Rebuild acceptedType string for HTML accept attribute (properly formatted)
7179
7179
  this.acceptedType = this.acceptedTypeArray.join(',');
7180
+ // Add file extension support for custom MIME types that browsers don't recognize
7181
+ // For application/BN (License files), also add .bn extension to accept attribute
7182
+ if (this.acceptedTypeArray.includes('application/BN')) {
7183
+ this.acceptedType = this.acceptedType + ',.bn';
7184
+ }
7180
7185
  // Process each accepted MIME type to build tooltip display names
7181
7186
  for (let index = 0; index < this.acceptedTypeArray.length; index++) {
7182
7187
  const element = this.acceptedTypeArray[index].trim();
@@ -7458,7 +7463,7 @@ class FileUploadComponent {
7458
7463
  }
7459
7464
  if (this.options.fileUploadAcceptsTypes != null &&
7460
7465
  this.options.fileUploadAcceptsTypes.length > 0 &&
7461
- !this.isFileTypeAccepted(fileType)) {
7466
+ !this.isFileTypeAccepted(fileType, file.name)) {
7462
7467
  // Remove only the file that violates the file type restriction
7463
7468
  this.uploader.queue = this.uploader.queue.filter(queueItem => queueItem.file.name !== file.name);
7464
7469
  hasValidationError = true;
@@ -7708,17 +7713,32 @@ class FileUploadComponent {
7708
7713
  }
7709
7714
  }
7710
7715
  }
7711
- isFileTypeAccepted(fileType) {
7716
+ isFileTypeAccepted(fileType, fileName) {
7712
7717
  if (!this.acceptedTypeArray || this.acceptedTypeArray.length === 0) {
7713
7718
  return true; // No restrictions
7714
7719
  }
7715
7720
  // Normalize the file type for comparison
7716
- const normalizedFileType = fileType.toLowerCase().trim();
7721
+ const normalizedFileType = fileType ? fileType.toLowerCase().trim() : '';
7717
7722
  // Check against all accepted types (case-insensitive and trimmed)
7718
- return this.acceptedTypeArray.some(acceptedType => {
7723
+ const isMimeTypeAccepted = this.acceptedTypeArray.some(acceptedType => {
7719
7724
  const normalizedAcceptedType = acceptedType.toLowerCase().trim();
7720
7725
  return normalizedAcceptedType === normalizedFileType;
7721
7726
  });
7727
+ // If MIME type matches, return true
7728
+ if (isMimeTypeAccepted) {
7729
+ return true;
7730
+ }
7731
+ // Handle custom MIME types that browsers don't recognize
7732
+ // For application/BN (License files), check file extension
7733
+ if (this.acceptedTypeArray.includes('application/BN') && fileName) {
7734
+ const fileExtension = fileName.toLowerCase().substring(fileName.lastIndexOf('.'));
7735
+ if (fileExtension === '.bn') {
7736
+ // Also accept application/octet-stream or empty type for .bn files
7737
+ // since browsers assign this to unknown file types
7738
+ return normalizedFileType === 'application/octet-stream' || normalizedFileType === '';
7739
+ }
7740
+ }
7741
+ return false;
7722
7742
  }
7723
7743
  setValuePreservingErrors(value, preserveErrors) {
7724
7744
  // Capture current duplicate errors before setValue clears them