@syncfusion/ej2-calendars 27.1.51 → 27.1.52

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.
@@ -3907,12 +3907,19 @@ let DatePicker = class DatePicker extends Calendar {
3907
3907
  this.show();
3908
3908
  }
3909
3909
  }
3910
- inputHandler() {
3910
+ inputHandler(e) {
3911
3911
  this.isPopupClicked = false;
3912
3912
  if (this.enableMask) {
3913
- this.notify('inputHandler', {
3914
- module: 'MaskedDateTime'
3915
- });
3913
+ if (!isNullOrUndefined(e) && !isNullOrUndefined(e.inputType) && e.inputType === 'insertFromPaste') {
3914
+ this.notify('maskPasteInputHandler', {
3915
+ module: 'MaskedDateTime'
3916
+ });
3917
+ }
3918
+ else {
3919
+ this.notify('inputHandler', {
3920
+ module: 'MaskedDateTime'
3921
+ });
3922
+ }
3916
3923
  }
3917
3924
  }
3918
3925
  inputBlurHandler(e) {
@@ -14368,6 +14375,7 @@ class MaskedDateTime {
14368
14375
  this.parent.on('inputHandler', this.maskInputHandler, this);
14369
14376
  this.parent.on('keyDownHandler', this.maskKeydownHandler, this);
14370
14377
  this.parent.on('clearHandler', this.clearHandler, this);
14378
+ this.parent.on('maskPasteInputHandler', this.maskPasteInputHandler, this);
14371
14379
  }
14372
14380
  removeEventListener() {
14373
14381
  if (this.parent.isDestroyed) {
@@ -14378,6 +14386,7 @@ class MaskedDateTime {
14378
14386
  this.parent.off('inputHandler', this.maskInputHandler);
14379
14387
  this.parent.off('keyDownHandler', this.maskKeydownHandler);
14380
14388
  this.parent.off('clearHandler', this.clearHandler);
14389
+ this.parent.off('maskPasteInputHandler', this.maskPasteInputHandler);
14381
14390
  }
14382
14391
  createMask(mask) {
14383
14392
  this.isDayPart = this.isMonthPart = this.isYearPart = this.isHourPart = this.isMinutePart = this.isSecondsPart = false;
@@ -14958,6 +14967,25 @@ class MaskedDateTime {
14958
14967
  }
14959
14968
  return formatValueSpecifier;
14960
14969
  }
14970
+ isValidDate(dateString) {
14971
+ const date = new Date(dateString);
14972
+ // Return true if the date is valid, false otherwise
14973
+ return !isNaN(date.getTime());
14974
+ }
14975
+ maskPasteInputHandler() {
14976
+ if (this.isValidDate(this.parent.inputElement.value)) {
14977
+ this.maskDateValue = new Date(this.parent.inputElement.value);
14978
+ this.isDayPart = this.isMonthPart = this.isYearPart = this.isHourPart = this.isMinutePart = this.isSecondsPart = true;
14979
+ this.updateValue();
14980
+ if (!this.isBlur) {
14981
+ this.validCharacterCheck();
14982
+ }
14983
+ return;
14984
+ }
14985
+ else {
14986
+ this.maskInputHandler();
14987
+ }
14988
+ }
14961
14989
  maskInputHandler() {
14962
14990
  let start = this.parent.inputElement.selectionStart;
14963
14991
  let formatText = '';
@@ -14973,7 +15001,6 @@ class MaskedDateTime {
14973
15001
  this.previousHiddenMask = this.hiddenMask;
14974
15002
  this.previousValue = inputValue;
14975
15003
  this.parent.inputElement.value = inputValue;
14976
- this.parent.inputElement.value = inputValue;
14977
15004
  for (let i = 0; i < this.hiddenMask.length; i++) {
14978
15005
  if (formatText === this.hiddenMask[i]) {
14979
15006
  start = i;