@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.
@@ -2546,7 +2546,7 @@ let Calendar = class Calendar extends CalendarBase {
2546
2546
  if (!isNullOrUndefined(this.value)) {
2547
2547
  this.setProperties({ value: this.value }, true);
2548
2548
  }
2549
- 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
2549
+ if (!this.isMultiSelection && +this.value !== Number.NaN && (!isNullOrUndefined(this.value) && !isNullOrUndefined(this.previousDate) || this.previousDate == null
2550
2550
  && !isNaN(+this.value))) {
2551
2551
  this.changeEvent(e);
2552
2552
  }
@@ -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);
@@ -4169,8 +4169,10 @@ let DatePicker = class DatePicker extends Calendar {
4169
4169
  this.trigger('navigated', this.navigatedArgs);
4170
4170
  }
4171
4171
  changeEvent(event) {
4172
- if (((this.previousDate && this.previousDate.valueOf()) !== (this.value && this.value.valueOf()))) {
4172
+ if (!this.isIconClicked) {
4173
4173
  this.selectCalendar(event);
4174
+ }
4175
+ if (((this.previousDate && this.previousDate.valueOf()) !== (this.value && this.value.valueOf()))) {
4174
4176
  this.changedArgs.event = event ? event : null;
4175
4177
  this.changedArgs.element = this.element;
4176
4178
  this.changedArgs.isInteracted = this.isInteracted;
@@ -4184,6 +4186,9 @@ let DatePicker = class DatePicker extends Calendar {
4184
4186
  this.previousElementValue = this.inputElement.value;
4185
4187
  this.errorClass();
4186
4188
  }
4189
+ else if (event) {
4190
+ this.hide(event);
4191
+ }
4187
4192
  }
4188
4193
  requiredModules() {
4189
4194
  const modules = [];
@@ -4271,7 +4276,7 @@ let DatePicker = class DatePicker extends Calendar {
4271
4276
  else {
4272
4277
  let prevent = true;
4273
4278
  let outOfRange;
4274
- if (!isNullOrUndefined(this.value) && !(+this.value >= +this.min && +this.value <= +this.max)) {
4279
+ if (!isNullOrUndefined(this.value) && !(+this.value >= +new Date(this.checkValue(this.min)) && +this.value <= +new Date(this.checkValue(this.max)))) {
4275
4280
  outOfRange = new Date(this.checkValue(this.value));
4276
4281
  this.setProperties({ 'value': null }, true);
4277
4282
  }
@@ -4735,14 +4740,16 @@ let DatePicker = class DatePicker extends Calendar {
4735
4740
  getModuleName() {
4736
4741
  return 'datepicker';
4737
4742
  }
4738
- disabledDates() {
4743
+ disabledDates(isDynamic = false) {
4739
4744
  let formatOptions;
4740
4745
  let globalize;
4741
4746
  const valueCopy = this.checkDateValue(this.value) ? new Date(+this.value) : new Date(this.checkValue(this.value));
4742
4747
  const previousValCopy = this.previousDate;
4743
4748
  //calls the Calendar render method to check the disabled dates through renderDayCell event and update the input value accordingly.
4744
4749
  this.minMaxUpdates();
4745
- super.render();
4750
+ if (!isDynamic || (isDynamic && !isNullOrUndefined(this.renderDayCell))) {
4751
+ super.render();
4752
+ }
4746
4753
  this.previousDate = previousValCopy;
4747
4754
  const date = valueCopy && +(valueCopy);
4748
4755
  const dateIdString = '*[id^="/id"]'.replace('/id', '' + date);
@@ -4751,7 +4758,7 @@ let DatePicker = class DatePicker extends Calendar {
4751
4758
  this.setProperties({ value: valueCopy }, true);
4752
4759
  }
4753
4760
  }
4754
- if (!isNullOrUndefined(this.calendarElement.querySelectorAll(dateIdString)[0])) {
4761
+ if (!isNullOrUndefined(this.calendarElement) && !isNullOrUndefined(this.calendarElement.querySelectorAll(dateIdString)[0])) {
4755
4762
  if (this.calendarElement.querySelectorAll(dateIdString)[0].classList.contains('e-disabled')) {
4756
4763
  if (!this.strictMode) {
4757
4764
  this.currentDate = new Date(new Date().setHours(0, 0, 0, 0));
@@ -4812,8 +4819,8 @@ let DatePicker = class DatePicker extends Calendar {
4812
4819
  const isDisabledDate = this.calendarElement &&
4813
4820
  this.calendarElement.querySelectorAll(dateIdString)[0] &&
4814
4821
  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))
4822
+ if ((!isNullOrUndefined(this.value) && !isNullOrUndefined(this.min) && !isNullOrUndefined(this.max) && !(new Date(this.value).setMilliseconds(0) >= new Date(this.min).setMilliseconds(0)
4823
+ && new Date(this.value).setMilliseconds(0) <= new Date(this.max).setMilliseconds(0)))
4817
4824
  || (!this.strictMode && this.inputElement.value !== '' && this.inputElement.value !== this.maskedDateValue && isNullOrUndefined(this.value) || isDisabledDate)) {
4818
4825
  addClass([this.inputWrapper.container], ERROR);
4819
4826
  attributes(this.inputElement, { 'aria-invalid': 'true' });
@@ -5830,7 +5837,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
5830
5837
  this.createControl();
5831
5838
  this.bindCalendarEvents();
5832
5839
  this.updateRange((this.isMobile ? [this.calendarElement] : [this.leftCalendar, this.rightCalendar]));
5833
- if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) && !isNullOrUndefined(this.renderDayCell)) {
5840
+ if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) && !isNullOrUndefined(this.renderDayCellArgs) && this.renderDayCellArgs.isDisabled) {
5834
5841
  this.disabledDateRender();
5835
5842
  }
5836
5843
  this.updateHeader();
@@ -6839,7 +6846,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
6839
6846
  if (!this.isMobile) {
6840
6847
  this.removeClassDisabled();
6841
6848
  }
6842
- if (!isNullOrUndefined(this.renderDayCell)) {
6849
+ if (!isNullOrUndefined(this.renderDayCellArgs) && this.renderDayCellArgs.isDisabled) {
6843
6850
  this.disabledDateRender();
6844
6851
  }
6845
6852
  this.trigger('select', this.rangeArgs(event));
@@ -8408,7 +8415,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
8408
8415
  if (!this.strictMode && (isDisabled)) {
8409
8416
  this.clearRange();
8410
8417
  }
8411
- if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) && !isDisabled && !isNullOrUndefined(this.renderDayCell)) {
8418
+ if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) && !isDisabled && !isNullOrUndefined(this.renderDayCellArgs) && this.renderDayCellArgs.isDisabled) {
8412
8419
  this.disabledDateRender();
8413
8420
  }
8414
8421
  this.errorClass();
@@ -8901,7 +8908,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
8901
8908
  if (!isNullOrUndefined(this.startValue) && !isNullOrUndefined(this.endValue)) {
8902
8909
  range = (Math.round(Math.abs((this.removeTimeValueFromDate(this.startValue).getTime() -
8903
8910
  this.removeTimeValueFromDate(this.endValue).getTime()) / (1000 * 60 * 60 * 24))) + 1);
8904
- if (!isNullOrUndefined(this.renderDayCell)) {
8911
+ if (!isNullOrUndefined(this.renderDayCellArgs) && this.renderDayCellArgs.isDisabled) {
8905
8912
  this.disabledDateRender();
8906
8913
  }
8907
8914
  if (!isNullOrUndefined(this.disabledDayCnt)) {
@@ -12216,7 +12223,7 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
12216
12223
  module: "MaskedDateTime",
12217
12224
  });
12218
12225
  }
12219
- this.setValue();
12226
+ this.setValue(true);
12220
12227
  if (this.enableMask && !this.value && this.maskedDateValue && (this.floatLabelType == 'Always' || !this.floatLabelType || !this.placeholder)) {
12221
12228
  Input.setValue(this.maskedDateValue, this.inputElement, this.floatLabelType, this.showClearButton);
12222
12229
  }
@@ -12235,7 +12242,7 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
12235
12242
  }
12236
12243
  this.renderComplete();
12237
12244
  }
12238
- setValue() {
12245
+ setValue(isDynamic = false) {
12239
12246
  this.initValue = this.validateMinMaxRange(this.value);
12240
12247
  if (!this.strictMode && this.isDateObject(this.initValue)) {
12241
12248
  const value = this.validateMinMaxRange(this.initValue);
@@ -12249,7 +12256,7 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
12249
12256
  }
12250
12257
  }
12251
12258
  this.valueWithMinutes = this.value;
12252
- super.updateInput();
12259
+ super.updateInput(isDynamic);
12253
12260
  }
12254
12261
  validateMinMaxRange(value) {
12255
12262
  let result = value;
@@ -12715,8 +12722,8 @@ let DateTimePicker = class DateTimePicker extends DatePicker {
12715
12722
  return popupHeight > height ? height : popupHeight;
12716
12723
  }
12717
12724
  changeEvent(e) {
12725
+ super.changeEvent(e);
12718
12726
  if ((this.value && this.value.valueOf()) !== (this.previousDateTime && +this.previousDateTime.valueOf())) {
12719
- super.changeEvent(e);
12720
12727
  this.valueWithMinutes = this.value;
12721
12728
  this.setInputValue('date');
12722
12729
  this.previousDateTime = this.value && new Date(+this.value);