@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.
@@ -7784,7 +7784,8 @@ let FormValidator = FormValidator_1 = class FormValidator extends Base {
7784
7784
  const currentRule = this.rules[`${name}`][`${rule}`];
7785
7785
  const dateFormat = ((rule === 'min' || rule === 'max') && this.rules['' + name].date &&
7786
7786
  typeof (this.rules['' + name].date) === 'string') ? this.rules['' + name].date : null;
7787
- const args = { value: this.inputElement.value, param: param, element: this.inputElement, formElement: this.element, format: dateFormat };
7787
+ const args = { value: this.inputElement.value,
7788
+ param: param, element: this.inputElement, formElement: this.element, format: dateFormat, culture: this.locale };
7788
7789
  this.trigger('validationBegin', args);
7789
7790
  if (!args.param && rule === 'required') {
7790
7791
  return true;
@@ -7966,7 +7967,7 @@ FormValidator.checkValidator = {
7966
7967
  },
7967
7968
  date: (option) => {
7968
7969
  if (!isNullOrUndefined(option.param) && (typeof (option.param) === 'string' && option.param !== '')) {
7969
- const globalize = new Internationalization;
7970
+ const globalize = option.culture && option.culture !== '' ? new Internationalization(option.culture) : new Internationalization;
7970
7971
  const dateOptions = { format: option.param.toString(), type: 'dateTime', skeleton: 'yMd' };
7971
7972
  const dateValue = globalize.parseDate(option.value, dateOptions);
7972
7973
  return (!isNullOrUndefined(dateValue) && dateValue instanceof Date && !isNaN(+dateValue));
@@ -7982,7 +7983,7 @@ FormValidator.checkValidator = {
7982
7983
  }
7983
7984
  // Maximum rule validation for date
7984
7985
  if (option.format && option.format !== '') {
7985
- const globalize = new Internationalization;
7986
+ const globalize = option.culture && option.culture !== '' ? new Internationalization(option.culture) : new Internationalization;
7986
7987
  const dateOptions = { format: option.format.toString(), type: 'dateTime', skeleton: 'yMd' };
7987
7988
  const dateValue = globalize.parseDate(option.value, dateOptions);
7988
7989
  const maxValue = (typeof (option.param) === 'string') ? globalize.parseDate(JSON.parse(JSON.stringify(option.param)), dateOptions) : option.param;
@@ -8004,7 +8005,7 @@ FormValidator.checkValidator = {
8004
8005
  else {
8005
8006
  // Minimum rule validation for date
8006
8007
  if (option.format && option.format !== '') {
8007
- const globalize = new Internationalization;
8008
+ const globalize = option.culture && option.culture !== '' ? new Internationalization(option.culture) : new Internationalization;
8008
8009
  const dateOptions = { format: option.format.toString(), type: 'dateTime', skeleton: 'yMd' };
8009
8010
  const dateValue = globalize.parseDate(option.value, dateOptions);
8010
8011
  const minValue = (typeof (option.param) === 'string') ? globalize.parseDate(JSON.parse(JSON.stringify(option.param)), dateOptions) : option.param;
@@ -9008,6 +9009,13 @@ let Uploader = class Uploader extends Component {
9008
9009
  this.element.value = '';
9009
9010
  }
9010
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
+ }
9011
9019
  }
9012
9020
  removeFilesData(file, customTemplate) {
9013
9021
  let index;
@@ -9304,7 +9312,7 @@ let Uploader = class Uploader extends Component {
9304
9312
  this.updateInitialFileDetails(args, targetFiles, file, i, fileData, directory, paste);
9305
9313
  }
9306
9314
  eventArgs.filesData = fileData;
9307
- if (this.allowedExtensions.indexOf('*') > -1) {
9315
+ if (!isNullOrUndefined(this.allowedExtensions) && this.allowedExtensions.indexOf('*') > -1) {
9308
9316
  this.allTypes = true;
9309
9317
  }
9310
9318
  if (this.enableHtmlSanitizer) {
@@ -9470,18 +9478,46 @@ let Uploader = class Uploader extends Component {
9470
9478
  isBlank(str) {
9471
9479
  return (!str || /^\s*$/.test(str));
9472
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
+ }
9473
9502
  checkExtension(files) {
9474
9503
  const dropFiles = files;
9475
9504
  if (!this.isBlank(this.allowedExtensions)) {
9476
9505
  const allowedExtensions = [];
9477
- const extensions = this.allowedExtensions.split(',');
9506
+ const extensions = !isNullOrUndefined(allowedExtensions) ? this.allowedExtensions.split(',') : [''];
9478
9507
  for (const extension of extensions) {
9479
9508
  allowedExtensions.push(extension.trim().toLocaleLowerCase());
9480
9509
  }
9481
9510
  for (let i = 0; i < files.length; i++) {
9482
9511
  const checkFileType = files[i].type.indexOf('.') !== -1 ?
9483
9512
  files[i].type.replace('.', '') : files[i].type;
9484
- 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)) {
9485
9521
  files[i].status = this.localizedTexts('invalidFileType');
9486
9522
  files[i].statusCode = '0';
9487
9523
  }
@@ -10255,6 +10291,15 @@ let Uploader = class Uploader extends Component {
10255
10291
  const progressBar = li.querySelector('.' + PROGRESSBAR);
10256
10292
  if (!isNullOrUndefined(progressBar)) {
10257
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
+ }
10258
10303
  }
10259
10304
  }
10260
10305
  removeProgressbar(li, callType) {
@@ -16675,12 +16720,15 @@ let Rating = class Rating extends Component {
16675
16720
  };
16676
16721
  this.tooltipOpen = false;
16677
16722
  this.isTouchSelected = false;
16723
+ if (closest(this.element, 'form') && this.element.getAttribute('value')) {
16724
+ this.setProperties({ value: this.element.getAttribute('value') }, true);
16725
+ }
16678
16726
  }
16679
16727
  render() {
16680
16728
  this.initialize();
16681
16729
  this.updateMinValue();
16682
16730
  this.updateTemplateFunction();
16683
- this.triggerChange(null, this.value, false);
16731
+ this.triggerChange(null, this.value, false, true);
16684
16732
  this.renderItems();
16685
16733
  this.displayLabel();
16686
16734
  }
@@ -17041,7 +17089,8 @@ let Rating = class Rating extends Component {
17041
17089
  this.updateItemValue();
17042
17090
  this.updateLabel();
17043
17091
  }
17044
- triggerChange(e, val, isInteracted = true) {
17092
+ triggerChange(e, val, isInteracted = true, isInitial = false) {
17093
+ const ratingObj = this;
17045
17094
  val = this.validateValue(val);
17046
17095
  this.currentValue = val;
17047
17096
  if (this.currentValue === this.value) {
@@ -17049,7 +17098,12 @@ let Rating = class Rating extends Component {
17049
17098
  }
17050
17099
  const eventArgs = { event: e, isInteracted: isInteracted, value: val, previousValue: this.value };
17051
17100
  this.setProperties({ value: val }, true);
17052
- this.trigger('valueChanged', eventArgs);
17101
+ if (this.isAngular && !isInitial) {
17102
+ ratingObj.localChange({ value: val });
17103
+ }
17104
+ if (!isInitial) {
17105
+ this.trigger('valueChanged', eventArgs);
17106
+ }
17053
17107
  }
17054
17108
  mouseMoveHandler(index, e) {
17055
17109
  if (this.isTouchSelected) {