@syncfusion/ej2-inputs 28.2.3 → 28.2.11

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.
@@ -8085,7 +8085,7 @@ var FormValidator = /** @__PURE__ @class */ (function (_super) {
8085
8085
  return regex.CREDITCARD.test(option.value);
8086
8086
  },
8087
8087
  number: function (option) {
8088
- return !isNaN(Number(option.value)) && option.value.indexOf(' ') === -1;
8088
+ return !isNaN(Number(option.value)) && String(option.value).indexOf(' ') === -1;
8089
8089
  },
8090
8090
  digits: function (option) {
8091
8091
  return regex.DIGITS.test(option.value);
@@ -9185,6 +9185,13 @@ var Uploader = /** @__PURE__ @class */ (function (_super) {
9185
9185
  this.element.value = '';
9186
9186
  }
9187
9187
  this.checkActionButtonStatus();
9188
+ if (this.actionButtons && this.clearButton && this.uploadWrapper) {
9189
+ var progressBarElements = this.uploadWrapper.querySelectorAll('.e-upload-progress-bar.e-upload-progress:not(.e-upload-success):not(.e-upload-fails)');
9190
+ if (progressBarElements.length === 1 && selectedElement.contains(progressBarElements[0])
9191
+ && this.clearButton.hasAttribute('disabled')) {
9192
+ this.clearButton.removeAttribute('disabled');
9193
+ }
9194
+ }
9188
9195
  };
9189
9196
  Uploader.prototype.removeFilesData = function (file, customTemplate) {
9190
9197
  var index;
@@ -9499,7 +9506,7 @@ var Uploader = /** @__PURE__ @class */ (function (_super) {
9499
9506
  this.updateInitialFileDetails(args, targetFiles, file, i, fileData, directory, paste);
9500
9507
  }
9501
9508
  eventArgs.filesData = fileData;
9502
- if (this.allowedExtensions.indexOf('*') > -1) {
9509
+ if (!isNullOrUndefined(this.allowedExtensions) && this.allowedExtensions.indexOf('*') > -1) {
9503
9510
  this.allTypes = true;
9504
9511
  }
9505
9512
  if (this.enableHtmlSanitizer) {
@@ -9665,11 +9672,32 @@ var Uploader = /** @__PURE__ @class */ (function (_super) {
9665
9672
  Uploader.prototype.isBlank = function (str) {
9666
9673
  return (!str || /^\s*$/.test(str));
9667
9674
  };
9675
+ Uploader.prototype.checkGenericExtension = function (genericType, fileExtension) {
9676
+ var validExtensions = [];
9677
+ switch (genericType.toLowerCase()) {
9678
+ case 'image/*':
9679
+ validExtensions.push('jpg', 'jpeg', 'png', 'gif', 'bmp', 'tiff', 'svg', 'webp', 'heic');
9680
+ break;
9681
+ case 'audio/*':
9682
+ validExtensions.push('mp3', 'wav', 'aac', 'flac', 'ogg', 'm4a');
9683
+ break;
9684
+ case 'video/*':
9685
+ validExtensions.push('mp4', 'mov', 'avi', 'mkv', 'flv', 'wmv', 'webm', 'mpeg');
9686
+ break;
9687
+ case 'application/*':
9688
+ validExtensions.push('doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'zip', 'rar', '7z', 'tar', 'pdf');
9689
+ break;
9690
+ case 'text/*':
9691
+ validExtensions.push('txt', 'csv', 'html', 'css', 'js', 'json', 'xml', 'md');
9692
+ break;
9693
+ }
9694
+ return validExtensions.includes(fileExtension.toLowerCase());
9695
+ };
9668
9696
  Uploader.prototype.checkExtension = function (files) {
9669
9697
  var dropFiles = files;
9670
9698
  if (!this.isBlank(this.allowedExtensions)) {
9671
9699
  var allowedExtensions = [];
9672
- var extensions = this.allowedExtensions.split(',');
9700
+ var extensions = !isNullOrUndefined(allowedExtensions) ? this.allowedExtensions.split(',') : [''];
9673
9701
  for (var _i = 0, extensions_1 = extensions; _i < extensions_1.length; _i++) {
9674
9702
  var extension = extensions_1[_i];
9675
9703
  allowedExtensions.push(extension.trim().toLocaleLowerCase());
@@ -9677,7 +9705,14 @@ var Uploader = /** @__PURE__ @class */ (function (_super) {
9677
9705
  for (var i = 0; i < files.length; i++) {
9678
9706
  var checkFileType = files[i].type.indexOf('.') !== -1 ?
9679
9707
  files[i].type.replace('.', '') : files[i].type;
9680
- if (allowedExtensions.indexOf(('.' + checkFileType).toLocaleLowerCase()) === -1) {
9708
+ if (allowedExtensions[0].indexOf('/*') !== -1) {
9709
+ var isValidExtension = this.checkGenericExtension(allowedExtensions[0], checkFileType);
9710
+ if (!isValidExtension) {
9711
+ files[i].status = this.localizedTexts('invalidFileType');
9712
+ files[i].statusCode = '0';
9713
+ }
9714
+ }
9715
+ else if ((allowedExtensions.indexOf(('.' + checkFileType).toLocaleLowerCase()) === -1)) {
9681
9716
  files[i].status = this.localizedTexts('invalidFileType');
9682
9717
  files[i].statusCode = '0';
9683
9718
  }
@@ -10464,6 +10499,15 @@ var Uploader = /** @__PURE__ @class */ (function (_super) {
10464
10499
  var progressBar = li.querySelector('.' + PROGRESSBAR);
10465
10500
  if (!isNullOrUndefined(progressBar)) {
10466
10501
  progressBar.classList.add(className);
10502
+ if (this.actionButtons && this.clearButton && this.uploadWrapper) {
10503
+ if (className === 'e-upload-progress' && !this.clearButton.hasAttribute('disabled')) {
10504
+ this.clearButton.setAttribute('disabled', 'disabled');
10505
+ }
10506
+ 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 &&
10507
+ this.clearButton.hasAttribute('disabled')) {
10508
+ this.clearButton.removeAttribute('disabled');
10509
+ }
10510
+ }
10467
10511
  }
10468
10512
  };
10469
10513
  Uploader.prototype.removeProgressbar = function (li, callType) {