@syncfusion/ej2-inputs 26.1.39 → 26.1.41

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.
@@ -143,7 +143,7 @@ var Input;
143
143
  function checkInputValue(floatLabelType, inputElement) {
144
144
  const inputValue = inputElement.value;
145
145
  const inputParent = inputElement.parentElement;
146
- const grandParent = inputParent.parentElement;
146
+ const grandParent = inputParent && inputParent.parentElement;
147
147
  if (inputValue !== '' && !isNullOrUndefined(inputValue)) {
148
148
  if (inputParent && inputParent.classList.contains('e-input-group')) {
149
149
  inputParent.classList.add('e-valid-input');
@@ -564,7 +564,7 @@ var Input;
564
564
  return;
565
565
  }
566
566
  const elementWidth = moduleName === 'multiselect' ? element : element.clientWidth - parseInt(getComputedStyle(element, null).getPropertyValue('padding-left'), 10);
567
- if (!isNullOrUndefined(container.getElementsByClassName('e-float-text-content')[0])) {
567
+ if (!isNullOrUndefined(container) && !isNullOrUndefined(container.getElementsByClassName('e-float-text-content')[0])) {
568
568
  if (container.getElementsByClassName('e-float-text-content')[0].classList.contains('e-float-text-overflow')) {
569
569
  container.getElementsByClassName('e-float-text-content')[0].classList.remove('e-float-text-overflow');
570
570
  }
@@ -608,7 +608,7 @@ var Input;
608
608
  if (parentElement.classList.contains(CLASSNAMES.FLOATINPUT)) {
609
609
  if (!isNullOrUndefined(placeholder) && placeholder !== '') {
610
610
  const floatTextContent = parentElement.getElementsByClassName('e-float-text-content')[0];
611
- if (floatTextContent) {
611
+ if (floatTextContent && floatTextContent.children[0]) {
612
612
  floatTextContent.children[0].textContent = placeholder;
613
613
  }
614
614
  else {
@@ -7781,7 +7781,8 @@ let FormValidator = FormValidator_1 = class FormValidator extends Base {
7781
7781
  const params = this.rules[`${name}`][`${rule}`];
7782
7782
  const param = (params instanceof Array && typeof params[1] === 'string') ? params[0] : params;
7783
7783
  const currentRule = this.rules[`${name}`][`${rule}`];
7784
- const args = { value: this.inputElement.value, param: param, element: this.inputElement, formElement: this.element };
7784
+ const dateFormat = ((rule === 'min' || rule === 'max') && this.rules["" + name].date && typeof (this.rules["" + name].date) === 'string') ? this.rules["" + name].date : null;
7785
+ const args = { value: this.inputElement.value, param: param, element: this.inputElement, formElement: this.element, format: dateFormat };
7785
7786
  this.trigger('validationBegin', args);
7786
7787
  if (!args.param && rule === 'required') {
7787
7788
  return true;
@@ -7978,7 +7979,16 @@ FormValidator.checkValidator = {
7978
7979
  return +option.value <= +option.param;
7979
7980
  }
7980
7981
  // Maximum rule validation for date
7981
- return new Date(option.value).getTime() <= new Date(JSON.parse(JSON.stringify(option.param))).getTime();
7982
+ if (option.format && option.format !== '') {
7983
+ const globalize = new Internationalization;
7984
+ const dateOptions = { format: option.format.toString(), type: 'dateTime', skeleton: 'yMd' };
7985
+ const dateValue = globalize.parseDate(option.value, dateOptions);
7986
+ const maxValue = (typeof (option.param) === 'string') ? globalize.parseDate(JSON.parse(JSON.stringify(option.param)), dateOptions) : option.param;
7987
+ return new Date(dateValue).getTime() <= new Date(maxValue).getTime();
7988
+ }
7989
+ else {
7990
+ return new Date(option.value).getTime() <= new Date(JSON.parse(JSON.stringify(option.param))).getTime();
7991
+ }
7982
7992
  },
7983
7993
  min: (option) => {
7984
7994
  if (!isNaN(Number(option.value))) {
@@ -7991,7 +8001,16 @@ FormValidator.checkValidator = {
7991
8001
  }
7992
8002
  else {
7993
8003
  // Minimum rule validation for date
7994
- return new Date(option.value).getTime() >= new Date(JSON.parse(JSON.stringify(option.param))).getTime();
8004
+ if (option.format && option.format !== '') {
8005
+ const globalize = new Internationalization;
8006
+ const dateOptions = { format: option.format.toString(), type: 'dateTime', skeleton: 'yMd' };
8007
+ const dateValue = globalize.parseDate(option.value, dateOptions);
8008
+ const minValue = (typeof (option.param) === 'string') ? globalize.parseDate(JSON.parse(JSON.stringify(option.param)), dateOptions) : option.param;
8009
+ return new Date(dateValue).getTime() >= new Date(minValue).getTime();
8010
+ }
8011
+ else {
8012
+ return new Date(option.value).getTime() >= new Date(JSON.parse(JSON.stringify(option.param))).getTime();
8013
+ }
7995
8014
  }
7996
8015
  },
7997
8016
  regex: (option) => {
@@ -8469,9 +8488,9 @@ let Uploader = class Uploader extends Component {
8469
8488
  this.element.setAttribute('tabindex', '-1');
8470
8489
  this.actionButtons = this.createElement('div', { className: ACTION_BUTTONS });
8471
8490
  this.uploadButton = this.createElement('button', { className: UPLOAD_BUTTONS,
8472
- attrs: { 'type': 'button', 'tabindex': this.btnTabIndex } });
8491
+ attrs: { 'type': 'button', 'tabindex': this.btnTabIndex, 'aria-label': this.localizedTexts('Upload') } });
8473
8492
  this.clearButton = this.createElement('button', { className: CLEAR_BUTTONS,
8474
- attrs: { 'type': 'button', 'tabindex': this.btnTabIndex } });
8493
+ attrs: { 'type': 'button', 'tabindex': this.btnTabIndex, 'aria-label': this.localizedTexts('Clear') } });
8475
8494
  this.actionButtons.appendChild(this.clearButton);
8476
8495
  this.actionButtons.appendChild(this.uploadButton);
8477
8496
  this.renderButtonTemplates();
@@ -8983,6 +9002,9 @@ let Uploader = class Uploader extends Component {
8983
9002
  else if (!closest(args.target, '.' + SPINNER_PANE)) {
8984
9003
  this.remove(fileData, false, false, true, args);
8985
9004
  }
9005
+ if (this.isForm && liElement && liElement.classList.contains(INVALID_FILE)) {
9006
+ this.element.value = '';
9007
+ }
8986
9008
  this.checkActionButtonStatus();
8987
9009
  }
8988
9010
  removeFilesData(file, customTemplate) {
@@ -9811,6 +9833,7 @@ let Uploader = class Uploader extends Component {
9811
9833
  }
9812
9834
  if (!iconElement.classList.contains(DELETE_ICON)) {
9813
9835
  iconElement.classList.add(REMOVE_ICON);
9836
+ iconElement.setAttribute('aria-label', this.localizedTexts('remove'));
9814
9837
  }
9815
9838
  const index = fileData.indexOf(listItem);
9816
9839
  const eventArgs = {
@@ -10064,6 +10087,7 @@ let Uploader = class Uploader extends Component {
10064
10087
  this.pauseButton = this.createElement('span', { className: 'e-icons e-file-reload-btn', attrs: { 'tabindex': this.btnTabIndex } });
10065
10088
  deleteIcon.parentElement.insertBefore(this.pauseButton, deleteIcon);
10066
10089
  this.pauseButton.setAttribute('title', this.localizedTexts('retry'));
10090
+ this.pauseButton.setAttribute('aria-label', this.localizedTexts('retry'));
10067
10091
  const retryElement = liElement.querySelector('.' + RETRY_ICON);
10068
10092
  /* istanbul ignore next */
10069
10093
  retryElement.addEventListener('click', (e) => {
@@ -10103,6 +10127,7 @@ let Uploader = class Uploader extends Component {
10103
10127
  if (!isNullOrUndefined(iconEle)) {
10104
10128
  iconEle.classList.add(DELETE_ICON);
10105
10129
  iconEle.setAttribute('title', this.localizedTexts('delete'));
10130
+ iconEle.setAttribute('aria-label', this.localizedTexts('delete'));
10106
10131
  iconEle.classList.remove(ABORT_ICON);
10107
10132
  iconEle.classList.remove(UPLOAD_INPROGRESS);
10108
10133
  }
@@ -10140,7 +10165,7 @@ let Uploader = class Uploader extends Component {
10140
10165
  }
10141
10166
  this.trigger('success', args, (args) => {
10142
10167
  this.updateStatus(file, args.statusText, '2');
10143
- this.uploadedFilesData.push(file);
10168
+ this.multiple ? this.uploadedFilesData.push(file) : this.uploadedFilesData = [file];
10144
10169
  this.trigger('change', { file: this.uploadedFilesData });
10145
10170
  this.checkActionButtonStatus();
10146
10171
  if (this.fileList.length > 0) {