@syncfusion/ej2-calendars 20.4.44 → 20.4.51

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.
@@ -2568,7 +2568,7 @@ var Calendar = /** @__PURE__ @class */ (function (_super) {
2568
2568
  if (!isNullOrUndefined(this.value)) {
2569
2569
  this.setProperties({ value: this.value }, true);
2570
2570
  }
2571
- if (!this.isMultiSelection && +this.value !== Number.NaN && (!isNullOrUndefined(this.value) && !isNullOrUndefined(this.previousDate) && +new Date(this.value.toDateString()) !== +new Date(this.previousDate.toDateString()) || this.previousDate == null
2571
+ if (!this.isMultiSelection && +this.value !== Number.NaN && (!isNullOrUndefined(this.value) && !isNullOrUndefined(this.previousDate) || this.previousDate == null
2572
2572
  && !isNaN(+this.value))) {
2573
2573
  this.changeEvent(e);
2574
2574
  }
@@ -3285,7 +3285,7 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
3285
3285
  this.createInput();
3286
3286
  this.updateHtmlAttributeToWrapper();
3287
3287
  this.setAllowEdit();
3288
- this.updateInput();
3288
+ this.updateInput(true);
3289
3289
  if (this.enableMask && !this.value && this.maskedDateValue && (this.floatLabelType == 'Always' || !this.floatLabelType || !this.placeholder)) {
3290
3290
  this.updateInputValue(this.maskedDateValue);
3291
3291
  }
@@ -3347,8 +3347,8 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
3347
3347
  DatePicker.prototype.updateInput = function (isDynamic) {
3348
3348
  if (isDynamic === void 0) { isDynamic = false; }
3349
3349
  var formatOptions;
3350
- if (this.value && !this.isCalendar() && !isDynamic) {
3351
- this.disabledDates();
3350
+ if (this.value && !this.isCalendar()) {
3351
+ this.disabledDates(isDynamic);
3352
3352
  }
3353
3353
  if (isNaN(+new Date(this.checkValue(this.value)))) {
3354
3354
  this.setProperties({ value: null }, true);
@@ -4213,8 +4213,10 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
4213
4213
  this.trigger('navigated', this.navigatedArgs);
4214
4214
  };
4215
4215
  DatePicker.prototype.changeEvent = function (event) {
4216
- if (((this.previousDate && this.previousDate.valueOf()) !== (this.value && this.value.valueOf()))) {
4216
+ if (!this.isIconClicked) {
4217
4217
  this.selectCalendar(event);
4218
+ }
4219
+ if (((this.previousDate && this.previousDate.valueOf()) !== (this.value && this.value.valueOf()))) {
4218
4220
  this.changedArgs.event = event ? event : null;
4219
4221
  this.changedArgs.element = this.element;
4220
4222
  this.changedArgs.isInteracted = this.isInteracted;
@@ -4228,6 +4230,9 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
4228
4230
  this.previousElementValue = this.inputElement.value;
4229
4231
  this.errorClass();
4230
4232
  }
4233
+ else if (event) {
4234
+ this.hide(event);
4235
+ }
4231
4236
  };
4232
4237
  DatePicker.prototype.requiredModules = function () {
4233
4238
  var modules = [];
@@ -4316,7 +4321,7 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
4316
4321
  else {
4317
4322
  var prevent_1 = true;
4318
4323
  var outOfRange = void 0;
4319
- if (!isNullOrUndefined(this.value) && !(+this.value >= +this.min && +this.value <= +this.max)) {
4324
+ if (!isNullOrUndefined(this.value) && !(+this.value >= +new Date(this.checkValue(this.min)) && +this.value <= +new Date(this.checkValue(this.max)))) {
4320
4325
  outOfRange = new Date(this.checkValue(this.value));
4321
4326
  this.setProperties({ 'value': null }, true);
4322
4327
  }
@@ -4782,14 +4787,17 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
4782
4787
  DatePicker.prototype.getModuleName = function () {
4783
4788
  return 'datepicker';
4784
4789
  };
4785
- DatePicker.prototype.disabledDates = function () {
4790
+ DatePicker.prototype.disabledDates = function (isDynamic) {
4791
+ if (isDynamic === void 0) { isDynamic = false; }
4786
4792
  var formatOptions;
4787
4793
  var globalize;
4788
4794
  var valueCopy = this.checkDateValue(this.value) ? new Date(+this.value) : new Date(this.checkValue(this.value));
4789
4795
  var previousValCopy = this.previousDate;
4790
4796
  //calls the Calendar render method to check the disabled dates through renderDayCell event and update the input value accordingly.
4791
4797
  this.minMaxUpdates();
4792
- _super.prototype.render.call(this);
4798
+ if (!isDynamic || (isDynamic && !isNullOrUndefined(this.renderDayCell))) {
4799
+ _super.prototype.render.call(this);
4800
+ }
4793
4801
  this.previousDate = previousValCopy;
4794
4802
  var date = valueCopy && +(valueCopy);
4795
4803
  var dateIdString = '*[id^="/id"]'.replace('/id', '' + date);
@@ -4798,7 +4806,7 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
4798
4806
  this.setProperties({ value: valueCopy }, true);
4799
4807
  }
4800
4808
  }
4801
- if (!isNullOrUndefined(this.calendarElement.querySelectorAll(dateIdString)[0])) {
4809
+ if (!isNullOrUndefined(this.calendarElement) && !isNullOrUndefined(this.calendarElement.querySelectorAll(dateIdString)[0])) {
4802
4810
  if (this.calendarElement.querySelectorAll(dateIdString)[0].classList.contains('e-disabled')) {
4803
4811
  if (!this.strictMode) {
4804
4812
  this.currentDate = new Date(new Date().setHours(0, 0, 0, 0));
@@ -4859,8 +4867,8 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
4859
4867
  var isDisabledDate = this.calendarElement &&
4860
4868
  this.calendarElement.querySelectorAll(dateIdString)[0] &&
4861
4869
  this.calendarElement.querySelectorAll(dateIdString)[0].classList.contains('e-disabled');
4862
- if ((!isNullOrUndefined(this.value) && !(+new Date(+this.value).setMilliseconds(0) >= +this.min
4863
- && +new Date(+this.value).setMilliseconds(0) <= +this.max))
4870
+ if ((!isNullOrUndefined(this.value) && !isNullOrUndefined(this.min) && !isNullOrUndefined(this.max) && !(new Date(this.value).setMilliseconds(0) >= new Date(this.min).setMilliseconds(0)
4871
+ && new Date(this.value).setMilliseconds(0) <= new Date(this.max).setMilliseconds(0)))
4864
4872
  || (!this.strictMode && this.inputElement.value !== '' && this.inputElement.value !== this.maskedDateValue && isNullOrUndefined(this.value) || isDisabledDate)) {
4865
4873
  addClass([this.inputWrapper.container], ERROR);
4866
4874
  attributes(this.inputElement, { 'aria-invalid': 'true' });
@@ -5904,7 +5912,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
5904
5912
  this.createControl();
5905
5913
  this.bindCalendarEvents();
5906
5914
  this.updateRange((this.isMobile ? [this.calendarElement] : [this.leftCalendar, this.rightCalendar]));
5907
- if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) && !isNullOrUndefined(this.renderDayCell)) {
5915
+ if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) && !isNullOrUndefined(this.renderDayCellArgs) && this.renderDayCellArgs.isDisabled) {
5908
5916
  this.disabledDateRender();
5909
5917
  }
5910
5918
  this.updateHeader();
@@ -6921,7 +6929,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
6921
6929
  if (!this.isMobile) {
6922
6930
  this.removeClassDisabled();
6923
6931
  }
6924
- if (!isNullOrUndefined(this.renderDayCell)) {
6932
+ if (!isNullOrUndefined(this.renderDayCellArgs) && this.renderDayCellArgs.isDisabled) {
6925
6933
  this.disabledDateRender();
6926
6934
  }
6927
6935
  this.trigger('select', this.rangeArgs(event));
@@ -8499,7 +8507,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
8499
8507
  if (!this.strictMode && (isDisabled)) {
8500
8508
  this.clearRange();
8501
8509
  }
8502
- if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) && !isDisabled && !isNullOrUndefined(this.renderDayCell)) {
8510
+ if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) && !isDisabled && !isNullOrUndefined(this.renderDayCellArgs) && this.renderDayCellArgs.isDisabled) {
8503
8511
  this.disabledDateRender();
8504
8512
  }
8505
8513
  this.errorClass();
@@ -8992,7 +9000,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
8992
9000
  if (!isNullOrUndefined(this.startValue) && !isNullOrUndefined(this.endValue)) {
8993
9001
  range = (Math.round(Math.abs((this.removeTimeValueFromDate(this.startValue).getTime() -
8994
9002
  this.removeTimeValueFromDate(this.endValue).getTime()) / (1000 * 60 * 60 * 24))) + 1);
8995
- if (!isNullOrUndefined(this.renderDayCell)) {
9003
+ if (!isNullOrUndefined(this.renderDayCellArgs) && this.renderDayCellArgs.isDisabled) {
8996
9004
  this.disabledDateRender();
8997
9005
  }
8998
9006
  if (!isNullOrUndefined(this.disabledDayCnt)) {
@@ -12355,7 +12363,7 @@ var DateTimePicker = /** @__PURE__ @class */ (function (_super) {
12355
12363
  module: "MaskedDateTime",
12356
12364
  });
12357
12365
  }
12358
- this.setValue();
12366
+ this.setValue(true);
12359
12367
  if (this.enableMask && !this.value && this.maskedDateValue && (this.floatLabelType == 'Always' || !this.floatLabelType || !this.placeholder)) {
12360
12368
  Input.setValue(this.maskedDateValue, this.inputElement, this.floatLabelType, this.showClearButton);
12361
12369
  }
@@ -12374,7 +12382,8 @@ var DateTimePicker = /** @__PURE__ @class */ (function (_super) {
12374
12382
  }
12375
12383
  this.renderComplete();
12376
12384
  };
12377
- DateTimePicker.prototype.setValue = function () {
12385
+ DateTimePicker.prototype.setValue = function (isDynamic) {
12386
+ if (isDynamic === void 0) { isDynamic = false; }
12378
12387
  this.initValue = this.validateMinMaxRange(this.value);
12379
12388
  if (!this.strictMode && this.isDateObject(this.initValue)) {
12380
12389
  var value = this.validateMinMaxRange(this.initValue);
@@ -12388,7 +12397,7 @@ var DateTimePicker = /** @__PURE__ @class */ (function (_super) {
12388
12397
  }
12389
12398
  }
12390
12399
  this.valueWithMinutes = this.value;
12391
- _super.prototype.updateInput.call(this);
12400
+ _super.prototype.updateInput.call(this, isDynamic);
12392
12401
  };
12393
12402
  DateTimePicker.prototype.validateMinMaxRange = function (value) {
12394
12403
  var result = value;
@@ -12856,8 +12865,8 @@ var DateTimePicker = /** @__PURE__ @class */ (function (_super) {
12856
12865
  return popupHeight > height ? height : popupHeight;
12857
12866
  };
12858
12867
  DateTimePicker.prototype.changeEvent = function (e) {
12868
+ _super.prototype.changeEvent.call(this, e);
12859
12869
  if ((this.value && this.value.valueOf()) !== (this.previousDateTime && +this.previousDateTime.valueOf())) {
12860
- _super.prototype.changeEvent.call(this, e);
12861
12870
  this.valueWithMinutes = this.value;
12862
12871
  this.setInputValue('date');
12863
12872
  this.previousDateTime = this.value && new Date(+this.value);