@syncfusion/ej2-inputs 28.1.41 → 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.
@@ -7923,7 +7923,8 @@ var FormValidator = /** @__PURE__ @class */ (function (_super) {
7923
7923
  var currentRule = this.rules["" + name]["" + rule];
7924
7924
  var dateFormat = ((rule === 'min' || rule === 'max') && this.rules['' + name].date &&
7925
7925
  typeof (this.rules['' + name].date) === 'string') ? this.rules['' + name].date : null;
7926
- var args = { value: this.inputElement.value, param: param, element: this.inputElement, formElement: this.element, format: dateFormat };
7926
+ var args = { value: this.inputElement.value,
7927
+ param: param, element: this.inputElement, formElement: this.element, format: dateFormat, culture: this.locale };
7927
7928
  this.trigger('validationBegin', args);
7928
7929
  if (!args.param && rule === 'required') {
7929
7930
  return true;
@@ -8105,7 +8106,7 @@ var FormValidator = /** @__PURE__ @class */ (function (_super) {
8105
8106
  },
8106
8107
  date: function (option) {
8107
8108
  if (!isNullOrUndefined(option.param) && (typeof (option.param) === 'string' && option.param !== '')) {
8108
- var globalize = new Internationalization;
8109
+ var globalize = option.culture && option.culture !== '' ? new Internationalization(option.culture) : new Internationalization;
8109
8110
  var dateOptions = { format: option.param.toString(), type: 'dateTime', skeleton: 'yMd' };
8110
8111
  var dateValue = globalize.parseDate(option.value, dateOptions);
8111
8112
  return (!isNullOrUndefined(dateValue) && dateValue instanceof Date && !isNaN(+dateValue));
@@ -8121,7 +8122,7 @@ var FormValidator = /** @__PURE__ @class */ (function (_super) {
8121
8122
  }
8122
8123
  // Maximum rule validation for date
8123
8124
  if (option.format && option.format !== '') {
8124
- var globalize = new Internationalization;
8125
+ var globalize = option.culture && option.culture !== '' ? new Internationalization(option.culture) : new Internationalization;
8125
8126
  var dateOptions = { format: option.format.toString(), type: 'dateTime', skeleton: 'yMd' };
8126
8127
  var dateValue = globalize.parseDate(option.value, dateOptions);
8127
8128
  var maxValue = (typeof (option.param) === 'string') ? globalize.parseDate(JSON.parse(JSON.stringify(option.param)), dateOptions) : option.param;
@@ -8143,7 +8144,7 @@ var FormValidator = /** @__PURE__ @class */ (function (_super) {
8143
8144
  else {
8144
8145
  // Minimum rule validation for date
8145
8146
  if (option.format && option.format !== '') {
8146
- var globalize = new Internationalization;
8147
+ var globalize = option.culture && option.culture !== '' ? new Internationalization(option.culture) : new Internationalization;
8147
8148
  var dateOptions = { format: option.format.toString(), type: 'dateTime', skeleton: 'yMd' };
8148
8149
  var dateValue = globalize.parseDate(option.value, dateOptions);
8149
8150
  var minValue = (typeof (option.param) === 'string') ? globalize.parseDate(JSON.parse(JSON.stringify(option.param)), dateOptions) : option.param;
@@ -9184,6 +9185,13 @@ var Uploader = /** @__PURE__ @class */ (function (_super) {
9184
9185
  this.element.value = '';
9185
9186
  }
9186
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
+ }
9187
9195
  };
9188
9196
  Uploader.prototype.removeFilesData = function (file, customTemplate) {
9189
9197
  var index;
@@ -9498,7 +9506,7 @@ var Uploader = /** @__PURE__ @class */ (function (_super) {
9498
9506
  this.updateInitialFileDetails(args, targetFiles, file, i, fileData, directory, paste);
9499
9507
  }
9500
9508
  eventArgs.filesData = fileData;
9501
- if (this.allowedExtensions.indexOf('*') > -1) {
9509
+ if (!isNullOrUndefined(this.allowedExtensions) && this.allowedExtensions.indexOf('*') > -1) {
9502
9510
  this.allTypes = true;
9503
9511
  }
9504
9512
  if (this.enableHtmlSanitizer) {
@@ -9664,11 +9672,32 @@ var Uploader = /** @__PURE__ @class */ (function (_super) {
9664
9672
  Uploader.prototype.isBlank = function (str) {
9665
9673
  return (!str || /^\s*$/.test(str));
9666
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
+ };
9667
9696
  Uploader.prototype.checkExtension = function (files) {
9668
9697
  var dropFiles = files;
9669
9698
  if (!this.isBlank(this.allowedExtensions)) {
9670
9699
  var allowedExtensions = [];
9671
- var extensions = this.allowedExtensions.split(',');
9700
+ var extensions = !isNullOrUndefined(allowedExtensions) ? this.allowedExtensions.split(',') : [''];
9672
9701
  for (var _i = 0, extensions_1 = extensions; _i < extensions_1.length; _i++) {
9673
9702
  var extension = extensions_1[_i];
9674
9703
  allowedExtensions.push(extension.trim().toLocaleLowerCase());
@@ -9676,7 +9705,14 @@ var Uploader = /** @__PURE__ @class */ (function (_super) {
9676
9705
  for (var i = 0; i < files.length; i++) {
9677
9706
  var checkFileType = files[i].type.indexOf('.') !== -1 ?
9678
9707
  files[i].type.replace('.', '') : files[i].type;
9679
- 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)) {
9680
9716
  files[i].status = this.localizedTexts('invalidFileType');
9681
9717
  files[i].statusCode = '0';
9682
9718
  }
@@ -10463,6 +10499,15 @@ var Uploader = /** @__PURE__ @class */ (function (_super) {
10463
10499
  var progressBar = li.querySelector('.' + PROGRESSBAR);
10464
10500
  if (!isNullOrUndefined(progressBar)) {
10465
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
+ }
10466
10511
  }
10467
10512
  };
10468
10513
  Uploader.prototype.removeProgressbar = function (li, callType) {
@@ -17112,12 +17157,15 @@ var Rating = /** @__PURE__ @class */ (function (_super) {
17112
17157
  };
17113
17158
  this.tooltipOpen = false;
17114
17159
  this.isTouchSelected = false;
17160
+ if (closest(this.element, 'form') && this.element.getAttribute('value')) {
17161
+ this.setProperties({ value: this.element.getAttribute('value') }, true);
17162
+ }
17115
17163
  };
17116
17164
  Rating.prototype.render = function () {
17117
17165
  this.initialize();
17118
17166
  this.updateMinValue();
17119
17167
  this.updateTemplateFunction();
17120
- this.triggerChange(null, this.value, false);
17168
+ this.triggerChange(null, this.value, false, true);
17121
17169
  this.renderItems();
17122
17170
  this.displayLabel();
17123
17171
  };
@@ -17484,8 +17532,10 @@ var Rating = /** @__PURE__ @class */ (function (_super) {
17484
17532
  this.updateItemValue();
17485
17533
  this.updateLabel();
17486
17534
  };
17487
- Rating.prototype.triggerChange = function (e, val, isInteracted) {
17535
+ Rating.prototype.triggerChange = function (e, val, isInteracted, isInitial) {
17488
17536
  if (isInteracted === void 0) { isInteracted = true; }
17537
+ if (isInitial === void 0) { isInitial = false; }
17538
+ var ratingObj = this;
17489
17539
  val = this.validateValue(val);
17490
17540
  this.currentValue = val;
17491
17541
  if (this.currentValue === this.value) {
@@ -17493,7 +17543,12 @@ var Rating = /** @__PURE__ @class */ (function (_super) {
17493
17543
  }
17494
17544
  var eventArgs = { event: e, isInteracted: isInteracted, value: val, previousValue: this.value };
17495
17545
  this.setProperties({ value: val }, true);
17496
- this.trigger('valueChanged', eventArgs);
17546
+ if (this.isAngular && !isInitial) {
17547
+ ratingObj.localChange({ value: val });
17548
+ }
17549
+ if (!isInitial) {
17550
+ this.trigger('valueChanged', eventArgs);
17551
+ }
17497
17552
  };
17498
17553
  Rating.prototype.mouseMoveHandler = function (index, e) {
17499
17554
  if (this.isTouchSelected) {