@syncfusion/ej2-calendars 33.1.44 → 33.2.4

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.
@@ -6016,10 +6016,13 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
6016
6016
  Input.setCssClass(cssNewClass, [this.popupWrapper], cssOldClass);
6017
6017
  }
6018
6018
  }
6019
+ isValidPreset() {
6020
+ return !isNullOrUndefined(this.presets[0]) && !isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label);
6021
+ }
6019
6022
  processPresets() {
6020
6023
  this.presetsItem = [];
6021
6024
  let i = 0;
6022
- if (!isNullOrUndefined(this.presets[0]) && !isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label)) {
6025
+ if (this.isValidPreset()) {
6023
6026
  for (const range of this.presets) {
6024
6027
  const id = range.label.replace(/\s+/g, '') + '_' + (++i);
6025
6028
  if (typeof range.end === 'string') {
@@ -6337,7 +6340,8 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
6337
6340
  this.popupWrapper.setAttribute('role', 'dialog');
6338
6341
  this.adjustLongHeaderWidth();
6339
6342
  const isPreset = (!this.isCustomRange || this.isMobile);
6340
- if (!isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label) && isPreset) {
6343
+ if (this.isValidPreset()
6344
+ && isPreset) {
6341
6345
  this.isCustomWindow = false;
6342
6346
  this.createPresets();
6343
6347
  this.listRippleEffect();
@@ -8317,7 +8321,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
8317
8321
  EventHandler.add(cancelBtn, 'click', this.cancelFunction, this);
8318
8322
  this.popupWrapper.appendChild(controlContainer);
8319
8323
  if (!this.isMobile) {
8320
- if (!isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label)) {
8324
+ if (this.isValidPreset()) {
8321
8325
  this.createPresets();
8322
8326
  this.listRippleEffect();
8323
8327
  addClass([controlContainer], RANGEBORDER);
@@ -8557,7 +8561,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
8557
8561
  }
8558
8562
  }
8559
8563
  createPresets() {
8560
- if (!isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label)) {
8564
+ if (this.isValidPreset()) {
8561
8565
  this.presetElement = this.createElement('div', { className: PRESETS, attrs: { 'tabindex': '0' } });
8562
8566
  const listTag = ListBase.createList(this.createElement, this.presetsItem, null, true);
8563
8567
  attributes(listTag, { 'role': 'listbox', 'aria-hidden': 'false', 'id': this.element.id + '_options', 'tabindex': '0', 'aria-label': 'daterangepicker-preset' });
@@ -8626,14 +8630,12 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
8626
8630
  relateTo: this.isMobile && this.isCustomWindow ? document.body :
8627
8631
  (!isNullOrUndefined(this.targetElement) ? this.targetElement : this.inputWrapper.container),
8628
8632
  position: (this.isMobile ?
8629
- (!isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label) && !this.isCustomWindow ?
8630
- { X: 'left', Y: 'bottom' } : { X: 'center', Y: 'center' }) :
8633
+ (this.isValidPreset() && !this.isCustomWindow ? { X: 'left', Y: 'bottom' } : { X: 'center', Y: 'center' }) :
8631
8634
  this.enableRtl ? { X: 'left', Y: 'bottom' } : { X: 'right', Y: 'bottom' }),
8632
8635
  offsetX: this.isMobile || this.enableRtl ? 0 : -popupWidth,
8633
8636
  offsetY: OFFSETVALUE$1,
8634
8637
  collision: this.isMobile ?
8635
- (!isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label) && !this.isCustomWindow ?
8636
- { X: 'fit' } : { X: 'fit', Y: 'fit' }) : { X: 'fit', Y: 'flip' },
8638
+ (this.isValidPreset() && !this.isCustomWindow ? { X: 'fit' } : { X: 'fit', Y: 'fit' }) : { X: 'fit', Y: 'flip' },
8637
8639
  targetType: this.isMobile && this.isCustomWindow ? 'container' : 'relative',
8638
8640
  enableRtl: this.enableRtl,
8639
8641
  zIndex: this.zIndex,
@@ -8708,7 +8710,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
8708
8710
  if (this.isRangeIconClicked) {
8709
8711
  this.inputWrapper.container.children[1].focus();
8710
8712
  }
8711
- if (!isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label)) {
8713
+ if (this.isValidPreset()) {
8712
8714
  this.unWireListEvents();
8713
8715
  }
8714
8716
  if (this.applyButton) {
@@ -9711,7 +9713,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
9711
9713
  this.openEventArgs.appendTo.appendChild(this.popupWrapper);
9712
9714
  this.showPopup(element, event);
9713
9715
  const isPreset = (!this.isCustomRange || (this.isMobile && this.isCustomRange));
9714
- if (!isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label) && isPreset) {
9716
+ if (this.isValidPreset() && isPreset) {
9715
9717
  this.setScrollPosition();
9716
9718
  }
9717
9719
  this.checkMinMaxDays();
@@ -9724,8 +9726,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
9724
9726
  super.setOverlayIndex(this.mobileRangePopupWrap, this.popupObj.element, this.modal, this.isMobile || Browser.isDevice);
9725
9727
  if (!isNullOrUndefined(this.mobileRangePopupWrap) && !isNullOrUndefined(this.popupObj)
9726
9728
  && !isNullOrUndefined(this.popupObj.element) && isNullOrUndefined(this.modal) &&
9727
- !isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label) && isPreset
9728
- && (this.isMobile || Browser.isDevice) && !this.isCustomWindow) {
9729
+ this.isValidPreset() && isPreset && (this.isMobile || Browser.isDevice) && !this.isCustomWindow) {
9729
9730
  const index = parseInt(this.popupObj.element.style.zIndex, 10) ?
9730
9731
  parseInt(this.popupObj.element.style.zIndex, 10) : 1000;
9731
9732
  this.mobileRangePopupWrap.style.zIndex = index.toString();