@syncfusion/ej2-calendars 20.4.42 → 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.
@@ -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);
@@ -4782,14 +4782,17 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
4782
4782
  DatePicker.prototype.getModuleName = function () {
4783
4783
  return 'datepicker';
4784
4784
  };
4785
- DatePicker.prototype.disabledDates = function () {
4785
+ DatePicker.prototype.disabledDates = function (isDynamic) {
4786
+ if (isDynamic === void 0) { isDynamic = false; }
4786
4787
  var formatOptions;
4787
4788
  var globalize;
4788
4789
  var valueCopy = this.checkDateValue(this.value) ? new Date(+this.value) : new Date(this.checkValue(this.value));
4789
4790
  var previousValCopy = this.previousDate;
4790
4791
  //calls the Calendar render method to check the disabled dates through renderDayCell event and update the input value accordingly.
4791
4792
  this.minMaxUpdates();
4792
- _super.prototype.render.call(this);
4793
+ if (!isDynamic || (isDynamic && !isNullOrUndefined(this.renderDayCell))) {
4794
+ _super.prototype.render.call(this);
4795
+ }
4793
4796
  this.previousDate = previousValCopy;
4794
4797
  var date = valueCopy && +(valueCopy);
4795
4798
  var dateIdString = '*[id^="/id"]'.replace('/id', '' + date);
@@ -4798,7 +4801,7 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
4798
4801
  this.setProperties({ value: valueCopy }, true);
4799
4802
  }
4800
4803
  }
4801
- if (!isNullOrUndefined(this.calendarElement.querySelectorAll(dateIdString)[0])) {
4804
+ if (!isNullOrUndefined(this.calendarElement) && !isNullOrUndefined(this.calendarElement.querySelectorAll(dateIdString)[0])) {
4802
4805
  if (this.calendarElement.querySelectorAll(dateIdString)[0].classList.contains('e-disabled')) {
4803
4806
  if (!this.strictMode) {
4804
4807
  this.currentDate = new Date(new Date().setHours(0, 0, 0, 0));
@@ -4859,8 +4862,8 @@ var DatePicker = /** @__PURE__ @class */ (function (_super) {
4859
4862
  var isDisabledDate = this.calendarElement &&
4860
4863
  this.calendarElement.querySelectorAll(dateIdString)[0] &&
4861
4864
  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))
4865
+ if ((!isNullOrUndefined(this.value) && !isNullOrUndefined(this.min) && !isNullOrUndefined(this.max) && !(new Date(this.value).setMilliseconds(0) >= new Date(this.min).setMilliseconds(0)
4866
+ && new Date(this.value).setMilliseconds(0) <= new Date(this.max).setMilliseconds(0)))
4864
4867
  || (!this.strictMode && this.inputElement.value !== '' && this.inputElement.value !== this.maskedDateValue && isNullOrUndefined(this.value) || isDisabledDate)) {
4865
4868
  addClass([this.inputWrapper.container], ERROR);
4866
4869
  attributes(this.inputElement, { 'aria-invalid': 'true' });
@@ -5904,7 +5907,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
5904
5907
  this.createControl();
5905
5908
  this.bindCalendarEvents();
5906
5909
  this.updateRange((this.isMobile ? [this.calendarElement] : [this.leftCalendar, this.rightCalendar]));
5907
- if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) && !isNullOrUndefined(this.renderDayCell)) {
5910
+ if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) && !isNullOrUndefined(this.renderDayCellArgs) && this.renderDayCellArgs.isDisabled) {
5908
5911
  this.disabledDateRender();
5909
5912
  }
5910
5913
  this.updateHeader();
@@ -6075,8 +6078,10 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
6075
6078
  if (range.length > 1) {
6076
6079
  this.invalidValueString = null;
6077
6080
  var dateOptions = { format: this.formatString, type: 'date', skeleton: 'yMd' };
6078
- var startDate = this.globalize.parseDate(range[0].trim(), dateOptions);
6079
- var endDate = this.globalize.parseDate(range[1].trim(), dateOptions);
6081
+ var start = new Date(range[0]);
6082
+ var end = new Date(range[1]);
6083
+ var startDate = this.getStartEndDate(start, false, range, dateOptions);
6084
+ var endDate = this.getStartEndDate(end, true, range, dateOptions);
6080
6085
  if (!isNullOrUndefined(startDate) && !isNaN(+startDate) && !isNullOrUndefined(endDate) && !isNaN(+endDate)) {
6081
6086
  var prevStartVal = this.startValue;
6082
6087
  this.startValue = startDate;
@@ -6148,6 +6153,17 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
6148
6153
  }
6149
6154
  this.updateHiddenInput();
6150
6155
  };
6156
+ DateRangePicker.prototype.getStartEndDate = function (date, isEnd, range, dateOptions) {
6157
+ if (this.depth === 'Month') {
6158
+ return this.globalize.parseDate(range[isEnd ? 1 : 0].trim(), dateOptions);
6159
+ }
6160
+ else if (this.depth === 'Year') {
6161
+ return new Date(date.getFullYear(), date.getMonth() + (isEnd ? 1 : 0), isEnd ? 0 : 1);
6162
+ }
6163
+ else {
6164
+ return new Date(date.getFullYear(), isEnd ? 11 : 0, isEnd ? 31 : 1);
6165
+ }
6166
+ };
6151
6167
  DateRangePicker.prototype.clearRange = function () {
6152
6168
  this.previousStartValue = this.previousEndValue = null;
6153
6169
  this.currentDate = null;
@@ -6908,7 +6924,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
6908
6924
  if (!this.isMobile) {
6909
6925
  this.removeClassDisabled();
6910
6926
  }
6911
- if (!isNullOrUndefined(this.renderDayCell)) {
6927
+ if (!isNullOrUndefined(this.renderDayCellArgs) && this.renderDayCellArgs.isDisabled) {
6912
6928
  this.disabledDateRender();
6913
6929
  }
6914
6930
  this.trigger('select', this.rangeArgs(event));
@@ -8486,7 +8502,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
8486
8502
  if (!this.strictMode && (isDisabled)) {
8487
8503
  this.clearRange();
8488
8504
  }
8489
- if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) && !isDisabled && !isNullOrUndefined(this.renderDayCell)) {
8505
+ if (!isNullOrUndefined(this.endValue) && !isNullOrUndefined(this.startValue) && !isDisabled && !isNullOrUndefined(this.renderDayCellArgs) && this.renderDayCellArgs.isDisabled) {
8490
8506
  this.disabledDateRender();
8491
8507
  }
8492
8508
  this.errorClass();
@@ -8979,7 +8995,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
8979
8995
  if (!isNullOrUndefined(this.startValue) && !isNullOrUndefined(this.endValue)) {
8980
8996
  range = (Math.round(Math.abs((this.removeTimeValueFromDate(this.startValue).getTime() -
8981
8997
  this.removeTimeValueFromDate(this.endValue).getTime()) / (1000 * 60 * 60 * 24))) + 1);
8982
- if (!isNullOrUndefined(this.renderDayCell)) {
8998
+ if (!isNullOrUndefined(this.renderDayCellArgs) && this.renderDayCellArgs.isDisabled) {
8983
8999
  this.disabledDateRender();
8984
9000
  }
8985
9001
  if (!isNullOrUndefined(this.disabledDayCnt)) {
@@ -9233,6 +9249,17 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
9233
9249
  this.updateHeader();
9234
9250
  }
9235
9251
  };
9252
+ DateRangePicker.prototype.getStartEndValue = function (date, isEnd) {
9253
+ if (this.depth === 'Month') {
9254
+ return this.checkDateValue(new Date(this.checkValue(date)));
9255
+ }
9256
+ else if (this.depth === 'Year') {
9257
+ return new Date(date.getFullYear(), date.getMonth() + (isEnd ? 1 : 0), isEnd ? 0 : 1);
9258
+ }
9259
+ else {
9260
+ return new Date(date.getFullYear(), isEnd ? 11 : 0, isEnd ? 31 : 1);
9261
+ }
9262
+ };
9236
9263
  /**
9237
9264
  * Called internally if any of the property value changed.
9238
9265
  *
@@ -9322,7 +9349,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
9322
9349
  newProp.startDate = this.globalize.parseDate(newProp.startDate, format);
9323
9350
  }
9324
9351
  if (+this.initStartDate !== +newProp.startDate) {
9325
- this.startValue = this.checkDateValue(new Date(this.checkValue(newProp.startDate)));
9352
+ this.startValue = this.getStartEndValue(newProp.startDate, false);
9326
9353
  this.setDate();
9327
9354
  this.setValue();
9328
9355
  }
@@ -9332,7 +9359,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
9332
9359
  newProp.endDate = this.globalize.parseDate(newProp.endDate, format);
9333
9360
  }
9334
9361
  if (+this.initEndDate !== +newProp.endDate) {
9335
- this.endValue = this.checkDateValue(new Date(this.checkValue(newProp.endDate)));
9362
+ this.endValue = this.getStartEndValue(newProp.endDate, true);
9336
9363
  this.setDate();
9337
9364
  this.setValue();
9338
9365
  }
@@ -12331,7 +12358,7 @@ var DateTimePicker = /** @__PURE__ @class */ (function (_super) {
12331
12358
  module: "MaskedDateTime",
12332
12359
  });
12333
12360
  }
12334
- this.setValue();
12361
+ this.setValue(true);
12335
12362
  if (this.enableMask && !this.value && this.maskedDateValue && (this.floatLabelType == 'Always' || !this.floatLabelType || !this.placeholder)) {
12336
12363
  Input.setValue(this.maskedDateValue, this.inputElement, this.floatLabelType, this.showClearButton);
12337
12364
  }
@@ -12350,7 +12377,8 @@ var DateTimePicker = /** @__PURE__ @class */ (function (_super) {
12350
12377
  }
12351
12378
  this.renderComplete();
12352
12379
  };
12353
- DateTimePicker.prototype.setValue = function () {
12380
+ DateTimePicker.prototype.setValue = function (isDynamic) {
12381
+ if (isDynamic === void 0) { isDynamic = false; }
12354
12382
  this.initValue = this.validateMinMaxRange(this.value);
12355
12383
  if (!this.strictMode && this.isDateObject(this.initValue)) {
12356
12384
  var value = this.validateMinMaxRange(this.initValue);
@@ -12364,7 +12392,7 @@ var DateTimePicker = /** @__PURE__ @class */ (function (_super) {
12364
12392
  }
12365
12393
  }
12366
12394
  this.valueWithMinutes = this.value;
12367
- _super.prototype.updateInput.call(this);
12395
+ _super.prototype.updateInput.call(this, isDynamic);
12368
12396
  };
12369
12397
  DateTimePicker.prototype.validateMinMaxRange = function (value) {
12370
12398
  var result = value;