@syncfusion/ej2-calendars 20.4.44 → 20.4.48

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.
@@ -3245,7 +3245,7 @@ let DatePicker = class DatePicker extends Calendar {
3245
3245
  this.createInput();
3246
3246
  this.updateHtmlAttributeToWrapper();
3247
3247
  this.setAllowEdit();
3248
- this.updateInput();
3248
+ this.updateInput(true);
3249
3249
  if (this.enableMask && !this.value && this.maskedDateValue && (this.floatLabelType == 'Always' || !this.floatLabelType || !this.placeholder)) {
3250
3250
  this.updateInputValue(this.maskedDateValue);
3251
3251
  }
@@ -3306,8 +3306,8 @@ let DatePicker = class DatePicker extends Calendar {
3306
3306
  }
3307
3307
  updateInput(isDynamic = false) {
3308
3308
  let formatOptions;
3309
- if (this.value && !this.isCalendar() && !isDynamic) {
3310
- this.disabledDates();
3309
+ if (this.value && !this.isCalendar()) {
3310
+ this.disabledDates(isDynamic);
3311
3311
  }
3312
3312
  if (isNaN(+new Date(this.checkValue(this.value)))) {
3313
3313
  this.setProperties({ value: null }, true);
@@ -4735,14 +4735,16 @@ let DatePicker = class DatePicker extends Calendar {
4735
4735
  getModuleName() {
4736
4736
  return 'datepicker';
4737
4737
  }
4738
- disabledDates() {
4738
+ disabledDates(isDynamic = false) {
4739
4739
  let formatOptions;
4740
4740
  let globalize;
4741
4741
  const valueCopy = this.checkDateValue(this.value) ? new Date(+this.value) : new Date(this.checkValue(this.value));
4742
4742
  const previousValCopy = this.previousDate;
4743
4743
  //calls the Calendar render method to check the disabled dates through renderDayCell event and update the input value accordingly.
4744
4744
  this.minMaxUpdates();
4745
- super.render();
4745
+ if (!isDynamic || (isDynamic && !isNullOrUndefined(this.renderDayCell))) {
4746
+ super.render();
4747
+ }
4746
4748
  this.previousDate = previousValCopy;
4747
4749
  const date = valueCopy && +(valueCopy);
4748
4750
  const dateIdString = '*[id^="/id"]'.replace('/id', '' + date);
@@ -4751,7 +4753,7 @@ let DatePicker = class DatePicker extends Calendar {
4751
4753
  this.setProperties({ value: valueCopy }, true);
4752
4754
  }
4753
4755
  }
4754
- if (!isNullOrUndefined(this.calendarElement.querySelectorAll(dateIdString)[0])) {
4756
+ if (!isNullOrUndefined(this.calendarElement) && !isNullOrUndefined(this.calendarElement.querySelectorAll(dateIdString)[0])) {
4755
4757
  if (this.calendarElement.querySelectorAll(dateIdString)[0].classList.contains('e-disabled')) {
4756
4758
  if (!this.strictMode) {
4757
4759
  this.currentDate = new Date(new Date().setHours(0, 0, 0, 0));
@@ -4812,8 +4814,8 @@ let DatePicker = class DatePicker extends Calendar {
4812
4814
  const isDisabledDate = this.calendarElement &&
4813
4815
  this.calendarElement.querySelectorAll(dateIdString)[0] &&
4814
4816
  this.calendarElement.querySelectorAll(dateIdString)[0].classList.contains('e-disabled');
4815
- if ((!isNullOrUndefined(this.value) && !(+new Date(+this.value).setMilliseconds(0) >= +this.min
4816
- && +new Date(+this.value).setMilliseconds(0) <= +this.max))
4817
+ if ((!isNullOrUndefined(this.value) && !isNullOrUndefined(this.min) && !isNullOrUndefined(this.max) && !(new Date(this.value).setMilliseconds(0) >= new Date(this.min).setMilliseconds(0)
4818
+ && new Date(this.value).setMilliseconds(0) <= new Date(this.max).setMilliseconds(0)))
4817
4819
  || (!this.strictMode && this.inputElement.value !== '' && this.inputElement.value !== this.maskedDateValue && isNullOrUndefined(this.value) || isDisabledDate)) {
4818
4820
  addClass([this.inputWrapper.container], ERROR);
4819
4821
  attributes(this.inputElement, { 'aria-invalid': 'true' });
@@ -5830,7 +5832,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
5830
5832
  this.createControl();
5831
5833
  this.bindCalendarEvents();
5832
5834
  this.updateRange((this.isMobile ? [this.calendarElement] : [this.leftCalendar, this.rightCalendar]));
5833
- if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) && !isNullOrUndefined(this.renderDayCell)) {
5835
+ if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) && !isNullOrUndefined(this.renderDayCellArgs) && this.renderDayCellArgs.isDisabled) {
5834
5836
  this.disabledDateRender();
5835
5837
  }
5836
5838
  this.updateHeader();
@@ -6839,7 +6841,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
6839
6841
  if (!this.isMobile) {
6840
6842
  this.removeClassDisabled();
6841
6843
  }
6842
- if (!isNullOrUndefined(this.renderDayCell)) {
6844
+ if (!isNullOrUndefined(this.renderDayCellArgs) && this.renderDayCellArgs.isDisabled) {
6843
6845
  this.disabledDateRender();
6844
6846
  }
6845
6847
  this.trigger('select', this.rangeArgs(event));
@@ -8408,7 +8410,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
8408
8410
  if (!this.strictMode && (isDisabled)) {
8409
8411
  this.clearRange();
8410
8412
  }
8411
- if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) && !isDisabled && !isNullOrUndefined(this.renderDayCell)) {
8413
+ if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) && !isDisabled && !isNullOrUndefined(this.renderDayCellArgs) && this.renderDayCellArgs.isDisabled) {
8412
8414
  this.disabledDateRender();
8413
8415
  }
8414
8416
  this.errorClass();
@@ -8901,7 +8903,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
8901
8903
  if (!isNullOrUndefined(this.startValue) && !isNullOrUndefined(this.endValue)) {
8902
8904
  range = (Math.round(Math.abs((this.removeTimeValueFromDate(this.startValue).getTime() -
8903
8905
  this.removeTimeValueFromDate(this.endValue).getTime()) / (1000 * 60 * 60 * 24))) + 1);
8904
- if (!isNullOrUndefined(this.renderDayCell)) {
8906
+ if (!isNullOrUndefined(this.renderDayCellArgs) && this.renderDayCellArgs.isDisabled) {
8905
8907
  this.disabledDateRender();
8906
8908
  }
8907
8909
  if (!isNullOrUndefined(this.disabledDayCnt)) {
@@ -12216,7 +12218,7 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
12216
12218
  module: "MaskedDateTime",
12217
12219
  });
12218
12220
  }
12219
- this.setValue();
12221
+ this.setValue(true);
12220
12222
  if (this.enableMask && !this.value && this.maskedDateValue && (this.floatLabelType == 'Always' || !this.floatLabelType || !this.placeholder)) {
12221
12223
  Input.setValue(this.maskedDateValue, this.inputElement, this.floatLabelType, this.showClearButton);
12222
12224
  }
@@ -12235,7 +12237,7 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
12235
12237
  }
12236
12238
  this.renderComplete();
12237
12239
  }
12238
- setValue() {
12240
+ setValue(isDynamic = false) {
12239
12241
  this.initValue = this.validateMinMaxRange(this.value);
12240
12242
  if (!this.strictMode && this.isDateObject(this.initValue)) {
12241
12243
  const value = this.validateMinMaxRange(this.initValue);
@@ -12249,7 +12251,7 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
12249
12251
  }
12250
12252
  }
12251
12253
  this.valueWithMinutes = this.value;
12252
- super.updateInput();
12254
+ super.updateInput(isDynamic);
12253
12255
  }
12254
12256
  validateMinMaxRange(value) {
12255
12257
  let result = value;