@syncfusion/ej2-calendars 33.2.3 → 33.2.5

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);
@@ -8421,6 +8425,9 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
8421
8425
  });
8422
8426
  }
8423
8427
  }
8428
+ if (this.isRangeIconClicked && this.openOnFocus) {
8429
+ this.isRangeIconClicked = false;
8430
+ }
8424
8431
  }
8425
8432
  onMouseClick(event, item) {
8426
8433
  if (event.type === 'touchstart') {
@@ -8557,7 +8564,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
8557
8564
  }
8558
8565
  }
8559
8566
  createPresets() {
8560
- if (!isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label)) {
8567
+ if (this.isValidPreset()) {
8561
8568
  this.presetElement = this.createElement('div', { className: PRESETS, attrs: { 'tabindex': '0' } });
8562
8569
  const listTag = ListBase.createList(this.createElement, this.presetsItem, null, true);
8563
8570
  attributes(listTag, { 'role': 'listbox', 'aria-hidden': 'false', 'id': this.element.id + '_options', 'tabindex': '0', 'aria-label': 'daterangepicker-preset' });
@@ -8626,14 +8633,12 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
8626
8633
  relateTo: this.isMobile && this.isCustomWindow ? document.body :
8627
8634
  (!isNullOrUndefined(this.targetElement) ? this.targetElement : this.inputWrapper.container),
8628
8635
  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' }) :
8636
+ (this.isValidPreset() && !this.isCustomWindow ? { X: 'left', Y: 'bottom' } : { X: 'center', Y: 'center' }) :
8631
8637
  this.enableRtl ? { X: 'left', Y: 'bottom' } : { X: 'right', Y: 'bottom' }),
8632
8638
  offsetX: this.isMobile || this.enableRtl ? 0 : -popupWidth,
8633
8639
  offsetY: OFFSETVALUE$1,
8634
8640
  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' },
8641
+ (this.isValidPreset() && !this.isCustomWindow ? { X: 'fit' } : { X: 'fit', Y: 'fit' }) : { X: 'fit', Y: 'flip' },
8637
8642
  targetType: this.isMobile && this.isCustomWindow ? 'container' : 'relative',
8638
8643
  enableRtl: this.enableRtl,
8639
8644
  zIndex: this.zIndex,
@@ -8708,7 +8713,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
8708
8713
  if (this.isRangeIconClicked) {
8709
8714
  this.inputWrapper.container.children[1].focus();
8710
8715
  }
8711
- if (!isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label)) {
8716
+ if (this.isValidPreset()) {
8712
8717
  this.unWireListEvents();
8713
8718
  }
8714
8719
  if (this.applyButton) {
@@ -9711,7 +9716,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
9711
9716
  this.openEventArgs.appendTo.appendChild(this.popupWrapper);
9712
9717
  this.showPopup(element, event);
9713
9718
  const isPreset = (!this.isCustomRange || (this.isMobile && this.isCustomRange));
9714
- if (!isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label) && isPreset) {
9719
+ if (this.isValidPreset() && isPreset) {
9715
9720
  this.setScrollPosition();
9716
9721
  }
9717
9722
  this.checkMinMaxDays();
@@ -9724,8 +9729,7 @@ let DateRangePicker = class DateRangePicker extends CalendarBase {
9724
9729
  super.setOverlayIndex(this.mobileRangePopupWrap, this.popupObj.element, this.modal, this.isMobile || Browser.isDevice);
9725
9730
  if (!isNullOrUndefined(this.mobileRangePopupWrap) && !isNullOrUndefined(this.popupObj)
9726
9731
  && !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) {
9732
+ this.isValidPreset() && isPreset && (this.isMobile || Browser.isDevice) && !this.isCustomWindow) {
9729
9733
  const index = parseInt(this.popupObj.element.style.zIndex, 10) ?
9730
9734
  parseInt(this.popupObj.element.style.zIndex, 10) : 1000;
9731
9735
  this.mobileRangePopupWrap.style.zIndex = index.toString();