@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.
@@ -6095,10 +6095,13 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
6095
6095
  Input.setCssClass(cssNewClass, [this.popupWrapper], cssOldClass);
6096
6096
  }
6097
6097
  };
6098
+ DateRangePicker.prototype.isValidPreset = function () {
6099
+ return !isNullOrUndefined(this.presets[0]) && !isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label);
6100
+ };
6098
6101
  DateRangePicker.prototype.processPresets = function () {
6099
6102
  this.presetsItem = [];
6100
6103
  var i = 0;
6101
- if (!isNullOrUndefined(this.presets[0]) && !isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label)) {
6104
+ if (this.isValidPreset()) {
6102
6105
  for (var _i = 0, _a = this.presets; _i < _a.length; _i++) {
6103
6106
  var range = _a[_i];
6104
6107
  var id = range.label.replace(/\s+/g, '') + '_' + (++i);
@@ -6418,7 +6421,8 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
6418
6421
  this.popupWrapper.setAttribute('role', 'dialog');
6419
6422
  this.adjustLongHeaderWidth();
6420
6423
  var isPreset = (!this.isCustomRange || this.isMobile);
6421
- if (!isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label) && isPreset) {
6424
+ if (this.isValidPreset()
6425
+ && isPreset) {
6422
6426
  this.isCustomWindow = false;
6423
6427
  this.createPresets();
6424
6428
  this.listRippleEffect();
@@ -8414,7 +8418,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
8414
8418
  EventHandler.add(cancelBtn, 'click', this.cancelFunction, this);
8415
8419
  this.popupWrapper.appendChild(controlContainer);
8416
8420
  if (!this.isMobile) {
8417
- if (!isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label)) {
8421
+ if (this.isValidPreset()) {
8418
8422
  this.createPresets();
8419
8423
  this.listRippleEffect();
8420
8424
  addClass([controlContainer], RANGEBORDER);
@@ -8518,6 +8522,9 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
8518
8522
  });
8519
8523
  }
8520
8524
  }
8525
+ if (this.isRangeIconClicked && this.openOnFocus) {
8526
+ this.isRangeIconClicked = false;
8527
+ }
8521
8528
  };
8522
8529
  DateRangePicker.prototype.onMouseClick = function (event, item) {
8523
8530
  if (event.type === 'touchstart') {
@@ -8656,7 +8663,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
8656
8663
  }
8657
8664
  };
8658
8665
  DateRangePicker.prototype.createPresets = function () {
8659
- if (!isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label)) {
8666
+ if (this.isValidPreset()) {
8660
8667
  this.presetElement = this.createElement('div', { className: PRESETS, attrs: { 'tabindex': '0' } });
8661
8668
  var listTag = ListBase.createList(this.createElement, this.presetsItem, null, true);
8662
8669
  attributes(listTag, { 'role': 'listbox', 'aria-hidden': 'false', 'id': this.element.id + '_options', 'tabindex': '0', 'aria-label': 'daterangepicker-preset' });
@@ -8726,14 +8733,12 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
8726
8733
  relateTo: this.isMobile && this.isCustomWindow ? document.body :
8727
8734
  (!isNullOrUndefined(this.targetElement) ? this.targetElement : this.inputWrapper.container),
8728
8735
  position: (this.isMobile ?
8729
- (!isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label) && !this.isCustomWindow ?
8730
- { X: 'left', Y: 'bottom' } : { X: 'center', Y: 'center' }) :
8736
+ (this.isValidPreset() && !this.isCustomWindow ? { X: 'left', Y: 'bottom' } : { X: 'center', Y: 'center' }) :
8731
8737
  this.enableRtl ? { X: 'left', Y: 'bottom' } : { X: 'right', Y: 'bottom' }),
8732
8738
  offsetX: this.isMobile || this.enableRtl ? 0 : -popupWidth,
8733
8739
  offsetY: OFFSETVALUE$1,
8734
8740
  collision: this.isMobile ?
8735
- (!isUndefined(this.presets[0].start && this.presets[0].end && this.presets[0].label) && !this.isCustomWindow ?
8736
- { X: 'fit' } : { X: 'fit', Y: 'fit' }) : { X: 'fit', Y: 'flip' },
8741
+ (this.isValidPreset() && !this.isCustomWindow ? { X: 'fit' } : { X: 'fit', Y: 'fit' }) : { X: 'fit', Y: 'flip' },
8737
8742
  targetType: this.isMobile && this.isCustomWindow ? 'container' : 'relative',
8738
8743
  enableRtl: this.enableRtl,
8739
8744
  zIndex: this.zIndex,
@@ -8808,7 +8813,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
8808
8813
  if (_this.isRangeIconClicked) {
8809
8814
  _this.inputWrapper.container.children[1].focus();
8810
8815
  }
8811
- if (!isUndefined(_this.presets[0].start && _this.presets[0].end && _this.presets[0].label)) {
8816
+ if (_this.isValidPreset()) {
8812
8817
  _this.unWireListEvents();
8813
8818
  }
8814
8819
  if (_this.applyButton) {
@@ -9812,7 +9817,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
9812
9817
  _this.openEventArgs.appendTo.appendChild(_this.popupWrapper);
9813
9818
  _this.showPopup(element, event);
9814
9819
  var isPreset = (!_this.isCustomRange || (_this.isMobile && _this.isCustomRange));
9815
- if (!isUndefined(_this.presets[0].start && _this.presets[0].end && _this.presets[0].label) && isPreset) {
9820
+ if (_this.isValidPreset() && isPreset) {
9816
9821
  _this.setScrollPosition();
9817
9822
  }
9818
9823
  _this.checkMinMaxDays();
@@ -9825,8 +9830,7 @@ var DateRangePicker = /** @__PURE__ @class */ (function (_super) {
9825
9830
  _super.prototype.setOverlayIndex.call(_this, _this.mobileRangePopupWrap, _this.popupObj.element, _this.modal, _this.isMobile || Browser.isDevice);
9826
9831
  if (!isNullOrUndefined(_this.mobileRangePopupWrap) && !isNullOrUndefined(_this.popupObj)
9827
9832
  && !isNullOrUndefined(_this.popupObj.element) && isNullOrUndefined(_this.modal) &&
9828
- !isUndefined(_this.presets[0].start && _this.presets[0].end && _this.presets[0].label) && isPreset
9829
- && (_this.isMobile || Browser.isDevice) && !_this.isCustomWindow) {
9833
+ _this.isValidPreset() && isPreset && (_this.isMobile || Browser.isDevice) && !_this.isCustomWindow) {
9830
9834
  var index = parseInt(_this.popupObj.element.style.zIndex, 10) ?
9831
9835
  parseInt(_this.popupObj.element.style.zIndex, 10) : 1000;
9832
9836
  _this.mobileRangePopupWrap.style.zIndex = index.toString();