@syncfusion/ej2-inputs 28.2.3 → 28.2.9

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.
@@ -9009,6 +9009,13 @@ let Uploader = class Uploader extends Component {
9009
9009
  this.element.value = '';
9010
9010
  }
9011
9011
  this.checkActionButtonStatus();
9012
+ if (this.actionButtons && this.clearButton && this.uploadWrapper) {
9013
+ const progressBarElements = this.uploadWrapper.querySelectorAll('.e-upload-progress-bar.e-upload-progress:not(.e-upload-success):not(.e-upload-fails)');
9014
+ if (progressBarElements.length === 1 && selectedElement.contains(progressBarElements[0])
9015
+ && this.clearButton.hasAttribute('disabled')) {
9016
+ this.clearButton.removeAttribute('disabled');
9017
+ }
9018
+ }
9012
9019
  }
9013
9020
  removeFilesData(file, customTemplate) {
9014
9021
  let index;
@@ -9305,7 +9312,7 @@ let Uploader = class Uploader extends Component {
9305
9312
  this.updateInitialFileDetails(args, targetFiles, file, i, fileData, directory, paste);
9306
9313
  }
9307
9314
  eventArgs.filesData = fileData;
9308
- if (this.allowedExtensions.indexOf('*') > -1) {
9315
+ if (!isNullOrUndefined(this.allowedExtensions) && this.allowedExtensions.indexOf('*') > -1) {
9309
9316
  this.allTypes = true;
9310
9317
  }
9311
9318
  if (this.enableHtmlSanitizer) {
@@ -9471,18 +9478,46 @@ let Uploader = class Uploader extends Component {
9471
9478
  isBlank(str) {
9472
9479
  return (!str || /^\s*$/.test(str));
9473
9480
  }
9481
+ checkGenericExtension(genericType, fileExtension) {
9482
+ const validExtensions = [];
9483
+ switch (genericType.toLowerCase()) {
9484
+ case 'image/*':
9485
+ validExtensions.push('jpg', 'jpeg', 'png', 'gif', 'bmp', 'tiff', 'svg', 'webp', 'heic');
9486
+ break;
9487
+ case 'audio/*':
9488
+ validExtensions.push('mp3', 'wav', 'aac', 'flac', 'ogg', 'm4a');
9489
+ break;
9490
+ case 'video/*':
9491
+ validExtensions.push('mp4', 'mov', 'avi', 'mkv', 'flv', 'wmv', 'webm', 'mpeg');
9492
+ break;
9493
+ case 'application/*':
9494
+ validExtensions.push('doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'zip', 'rar', '7z', 'tar', 'pdf');
9495
+ break;
9496
+ case 'text/*':
9497
+ validExtensions.push('txt', 'csv', 'html', 'css', 'js', 'json', 'xml', 'md');
9498
+ break;
9499
+ }
9500
+ return validExtensions.includes(fileExtension.toLowerCase());
9501
+ }
9474
9502
  checkExtension(files) {
9475
9503
  const dropFiles = files;
9476
9504
  if (!this.isBlank(this.allowedExtensions)) {
9477
9505
  const allowedExtensions = [];
9478
- const extensions = this.allowedExtensions.split(',');
9506
+ const extensions = !isNullOrUndefined(allowedExtensions) ? this.allowedExtensions.split(',') : [''];
9479
9507
  for (const extension of extensions) {
9480
9508
  allowedExtensions.push(extension.trim().toLocaleLowerCase());
9481
9509
  }
9482
9510
  for (let i = 0; i < files.length; i++) {
9483
9511
  const checkFileType = files[i].type.indexOf('.') !== -1 ?
9484
9512
  files[i].type.replace('.', '') : files[i].type;
9485
- if (allowedExtensions.indexOf(('.' + checkFileType).toLocaleLowerCase()) === -1) {
9513
+ if (allowedExtensions[0].indexOf('/*') !== -1) {
9514
+ const isValidExtension = this.checkGenericExtension(allowedExtensions[0], checkFileType);
9515
+ if (!isValidExtension) {
9516
+ files[i].status = this.localizedTexts('invalidFileType');
9517
+ files[i].statusCode = '0';
9518
+ }
9519
+ }
9520
+ else if ((allowedExtensions.indexOf(('.' + checkFileType).toLocaleLowerCase()) === -1)) {
9486
9521
  files[i].status = this.localizedTexts('invalidFileType');
9487
9522
  files[i].statusCode = '0';
9488
9523
  }
@@ -10256,6 +10291,15 @@ let Uploader = class Uploader extends Component {
10256
10291
  const progressBar = li.querySelector('.' + PROGRESSBAR);
10257
10292
  if (!isNullOrUndefined(progressBar)) {
10258
10293
  progressBar.classList.add(className);
10294
+ if (this.actionButtons && this.clearButton && this.uploadWrapper) {
10295
+ if (className === 'e-upload-progress' && !this.clearButton.hasAttribute('disabled')) {
10296
+ this.clearButton.setAttribute('disabled', 'disabled');
10297
+ }
10298
+ else if ((className === 'e-upload-success' || className === 'e-upload-fails') && this.uploadWrapper.querySelectorAll('.e-upload-progress-bar.e-upload-progress:not(.e-upload-success):not(.e-upload-fails)').length === 0 &&
10299
+ this.clearButton.hasAttribute('disabled')) {
10300
+ this.clearButton.removeAttribute('disabled');
10301
+ }
10302
+ }
10259
10303
  }
10260
10304
  }
10261
10305
  removeProgressbar(li, callType) {