@syncfusion/ej2-calendars 35.1.41 → 35.1.43

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.
@@ -2347,6 +2347,12 @@ var Calendar = /** @__PURE__ @class */ (function (_super) {
2347
2347
  else {
2348
2348
  tempValue = new Date(tempValue.getFullYear(), tempValue.getMonth(), tempValue.getDate(), 0, 0, 0, 0);
2349
2349
  }
2350
+ if (+tempValue < +this.min) {
2351
+ tempValue = new Date(+this.min);
2352
+ }
2353
+ else if (+tempValue > +this.max) {
2354
+ tempValue = new Date(+this.max);
2355
+ }
2350
2356
  return tempValue;
2351
2357
  };
2352
2358
  Calendar.prototype.todayButtonClick = function (e) {
@@ -3472,7 +3478,7 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
3472
3478
  this.setAllowEdit();
3473
3479
  if (this.enableMask && !this.value && this.maskedDateValue && (this.floatLabelType === 'Always' || !this.floatLabelType || !this.placeholder)) {
3474
3480
  this.updateInput(true);
3475
- this.updateInputValue(this.maskedDateValue);
3481
+ this.setMaskedInputValue();
3476
3482
  }
3477
3483
  else if (!this.enableMask) {
3478
3484
  this.updateInput(true);
@@ -3594,7 +3600,7 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
3594
3600
  this.updateInputValue('');
3595
3601
  }
3596
3602
  else {
3597
- this.updateInputValue(this.maskedDateValue);
3603
+ this.setMaskedInputValue();
3598
3604
  this.notify('createMask', {
3599
3605
  module: 'MaskedDateTime'
3600
3606
  });
@@ -3886,6 +3892,31 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
3886
3892
  DatePicker.prototype.updateInputValue = function (value) {
3887
3893
  Input.setValue(value, this.inputElement, this.floatLabelType, this.showClearButton);
3888
3894
  };
3895
+ DatePicker.prototype.isMaskPlaceholderSwap = function () {
3896
+ return this.getModuleName() === 'datepicker' && this.enableMask && this.strictMode
3897
+ && (!this.placeholder || this.floatLabelType === 'Always') && !!this.maskedDateValue
3898
+ && !this.value && !isNullOrUndefined(this.inputElement) && !isNullOrUndefined(closest(this.inputElement, 'form'));
3899
+ };
3900
+ DatePicker.prototype.setMaskedInputValue = function () {
3901
+ if (this.isMaskPlaceholderSwap() && (this.isBlur || document.activeElement !== this.inputElement)) {
3902
+ this.swapMaskPlaceholder(false);
3903
+ }
3904
+ else {
3905
+ this.updateInputValue(this.maskedDateValue);
3906
+ }
3907
+ };
3908
+ DatePicker.prototype.swapMaskPlaceholder = function (toValue) {
3909
+ if (toValue) {
3910
+ this.updateInputValue(this.maskedDateValue);
3911
+ if (this.inputElement.hasAttribute('placeholder')) {
3912
+ this.inputElement.removeAttribute('placeholder');
3913
+ }
3914
+ }
3915
+ else {
3916
+ this.updateInputValue('');
3917
+ this.inputElement.setAttribute('placeholder', this.maskedDateValue);
3918
+ }
3919
+ };
3889
3920
  DatePicker.prototype.windowResize = function () {
3890
3921
  this.updateFloatLabelOverflowWidth(true);
3891
3922
  };
@@ -4022,7 +4053,10 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
4022
4053
  if (this.initTimeZone !== new Date().getTimezoneOffset()) {
4023
4054
  this.strictModeUpdate(true);
4024
4055
  }
4025
- if (this.enableMask && !this.inputElement.value && this.placeholder) {
4056
+ if (this.isMaskPlaceholderSwap() && (!this.inputElement.value || this.inputElement.value === this.maskedDateValue)) {
4057
+ this.swapMaskPlaceholder(true);
4058
+ }
4059
+ else if (this.enableMask && !this.inputElement.value && this.placeholder) {
4026
4060
  if (this.maskedDateValue && !this.value && (this.floatLabelType === 'Auto' || this.floatLabelType === 'Never' || this.placeholder)) {
4027
4061
  this.updateInputValue(this.maskedDateValue);
4028
4062
  this.inputElement.selectionStart = 0;
@@ -4073,7 +4107,10 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
4073
4107
  this.isBlur = false;
4074
4108
  this.popupUpdate();
4075
4109
  this.changeTrigger(e);
4076
- if (this.enableMask && this.maskedDateValue && this.placeholder && this.floatLabelType !== 'Always') {
4110
+ if (this.isMaskPlaceholderSwap() && (!this.inputElement.value || this.inputElement.value === this.maskedDateValue)) {
4111
+ this.swapMaskPlaceholder(false);
4112
+ }
4113
+ else if (this.enableMask && this.maskedDateValue && this.placeholder && this.floatLabelType !== 'Always') {
4077
4114
  if (this.inputElement.value === this.maskedDateValue && !this.value && (this.floatLabelType === 'Auto' || this.floatLabelType === 'Never' || this.placeholder)) {
4078
4115
  this.updateInputValue('');
4079
4116
  }
@@ -5338,7 +5375,7 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
5338
5375
  if (!this.popupObj) {
5339
5376
  this.updateInputValue(inputVal);
5340
5377
  if (this.enableMask) {
5341
- this.updateInputValue(this.maskedDateValue);
5378
+ this.setMaskedInputValue();
5342
5379
  this.notify('createMask', {
5343
5380
  module: 'MaskedDateTime', isBlur: isBlur
5344
5381
  });
@@ -5411,7 +5448,7 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
5411
5448
  this.previousElementValue = this.inputElement.value;
5412
5449
  if (isNullOrUndefined(this.value)) {
5413
5450
  if (this.enableMask) {
5414
- this.updateInputValue(this.maskedDateValue);
5451
+ this.setMaskedInputValue();
5415
5452
  }
5416
5453
  else {
5417
5454
  this.updateInputValue('');
@@ -5523,13 +5560,21 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
5523
5560
  this.notify('createMask', {
5524
5561
  module: 'MaskedDateTime'
5525
5562
  });
5526
- this.updateInputValue(this.maskedDateValue);
5563
+ if (this.isMaskPlaceholderSwap() && document.activeElement !== this.inputElement) {
5564
+ this.swapMaskPlaceholder(false);
5565
+ }
5566
+ else {
5567
+ this.updateInputValue(this.maskedDateValue);
5568
+ }
5527
5569
  this.bindInputEvent();
5528
5570
  }
5529
5571
  else {
5530
5572
  if (this.inputElement.value === this.maskedDateValue) {
5531
5573
  this.updateInputValue('');
5532
5574
  }
5575
+ if (!this.placeholder && this.inputElement.hasAttribute('placeholder') && this.inputElement.getAttribute('placeholder') === this.maskedDateValue) {
5576
+ this.inputElement.removeAttribute('placeholder');
5577
+ }
5533
5578
  }
5534
5579
  break;
5535
5580
  case 'min':