@syncfusion/ej2-schedule 20.4.43 → 20.4.44

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.
@@ -9347,7 +9347,7 @@ var QuickPopups = /** @__PURE__ @class */ (function () {
9347
9347
  if (deleteIcon) {
9348
9348
  this.renderButton('e-flat e-round e-small', ICON + ' ' + DELETE_ICON_CLASS, deleteAction, deleteIcon, this.deleteClick);
9349
9349
  }
9350
- this.beforeQuickPopupOpen(target);
9350
+ this.beforeQuickPopupOpen(target, e);
9351
9351
  };
9352
9352
  QuickPopups.prototype.isCellBlocked = function (args) {
9353
9353
  var tempObj = {};
@@ -9434,7 +9434,7 @@ var QuickPopups = /** @__PURE__ @class */ (function () {
9434
9434
  this.quickPopup.content = quickCellPopup;
9435
9435
  this.quickPopup.relateTo = target;
9436
9436
  this.quickPopup.dataBind();
9437
- this.beforeQuickPopupOpen(target);
9437
+ this.beforeQuickPopupOpen(target, args.event);
9438
9438
  };
9439
9439
  QuickPopups.prototype.isSameEventClick = function (events) {
9440
9440
  var isSameTarget = this.quickPopup.relateTo === closest(events.element, '.' + APPOINTMENT_CLASS);
@@ -9511,7 +9511,7 @@ var QuickPopups = /** @__PURE__ @class */ (function () {
9511
9511
  this.quickPopup.relateTo = this.parent.isAdaptive ? document.body :
9512
9512
  closest(events.element, '.' + APPOINTMENT_CLASS);
9513
9513
  this.quickPopup.dataBind();
9514
- this.beforeQuickPopupOpen(events.element);
9514
+ this.beforeQuickPopupOpen(events.element, events.originalEvent);
9515
9515
  }
9516
9516
  };
9517
9517
  QuickPopups.prototype.getPopupHeader = function (headerType, headerData) {
@@ -9792,15 +9792,16 @@ var QuickPopups = /** @__PURE__ @class */ (function () {
9792
9792
  this.morePopup.relateTo = closest(target, '.' + WORK_CELLS_CLASS);
9793
9793
  }
9794
9794
  }
9795
- this.parent.renderTemplates();
9796
- var eventProp = {
9797
- type: 'EventContainer', cancel: false,
9798
- element: this.morePopup.element, data: data
9799
- };
9800
- this.parent.trigger(popupOpen, eventProp, function (popupArgs) {
9801
- if (!popupArgs.cancel) {
9802
- _this.morePopup.show();
9803
- }
9795
+ this.parent.renderTemplates(function () {
9796
+ var eventProp = {
9797
+ type: 'EventContainer', cancel: false,
9798
+ element: _this.morePopup.element, data: data
9799
+ };
9800
+ _this.parent.trigger(popupOpen, eventProp, function (popupArgs) {
9801
+ if (!popupArgs.cancel) {
9802
+ _this.morePopup.show();
9803
+ }
9804
+ });
9804
9805
  });
9805
9806
  };
9806
9807
  QuickPopups.prototype.saveClick = function (event) {
@@ -9991,71 +9992,95 @@ var QuickPopups = /** @__PURE__ @class */ (function () {
9991
9992
  }
9992
9993
  });
9993
9994
  };
9994
- QuickPopups.prototype.beforeQuickPopupOpen = function (target) {
9995
+ QuickPopups.prototype.beforeQuickPopupOpen = function (target, originalEvent) {
9995
9996
  var _this = this;
9996
- this.parent.renderTemplates();
9997
- var isEventPopup = this.quickPopup.element.querySelector('.' + EVENT_POPUP_CLASS);
9998
- var popupType = this.parent.isAdaptive ? isEventPopup ? 'ViewEventInfo' : 'EditEventInfo' : 'QuickInfo';
9999
- var eventProp = {
10000
- type: popupType, cancel: false, data: extend({}, this.getDataFromTarget(target), null, true),
10001
- target: target, element: this.quickPopup.element
10002
- };
10003
- this.parent.trigger(popupOpen, eventProp, function (popupArgs) {
10004
- if (popupArgs.cancel) {
10005
- _this.quickPopupHide();
10006
- _this.destroyPopupButtons('quickPopup');
10007
- if (popupArgs.element.classList.contains(POPUP_OPEN)) {
10008
- _this.quickPopupClose();
10009
- }
10010
- removeChildren(_this.quickPopup.element);
10011
- _this.isMultipleEventSelect = false;
10012
- }
10013
- else {
10014
- var display = _this.quickPopup.element.style.display;
10015
- _this.quickPopup.element.style.display = 'block';
10016
- if (_this.parent.isAdaptive) {
10017
- _this.quickPopup.element.removeAttribute('style');
10018
- _this.quickPopup.element.style.display = 'block';
10019
- _this.quickPopup.element.style.height = formatUnit((popupType === 'EditEventInfo') ? 65 : window.innerHeight);
9997
+ this.parent.renderTemplates(function () {
9998
+ var isEventPopup = _this.quickPopup.element.querySelector('.' + EVENT_POPUP_CLASS);
9999
+ var popupType = _this.parent.isAdaptive ? isEventPopup ? 'ViewEventInfo' : 'EditEventInfo' : 'QuickInfo';
10000
+ var eventProp = {
10001
+ type: popupType, cancel: false, data: extend({}, _this.getDataFromTarget(target), null, true),
10002
+ target: target, element: _this.quickPopup.element
10003
+ };
10004
+ _this.parent.trigger(popupOpen, eventProp, function (popupArgs) {
10005
+ if (popupArgs.cancel) {
10006
+ _this.quickPopupHide();
10007
+ _this.destroyPopupButtons('quickPopup');
10008
+ if (popupArgs.element.classList.contains(POPUP_OPEN)) {
10009
+ _this.quickPopupClose();
10010
+ }
10011
+ removeChildren(_this.quickPopup.element);
10012
+ _this.isMultipleEventSelect = false;
10020
10013
  }
10021
10014
  else {
10022
- var isVirtualScroll = _this.parent.virtualScrollModule && _this.parent.virtualScrollModule.isHorizontalScroll
10023
- && !isNullOrUndefined(closest(target, '.' + CONTENT_TABLE_CLASS));
10024
- var conTable = _this.parent.element.querySelector('.' + CONTENT_WRAP_CLASS + ' table');
10025
- _this.quickPopup.offsetX = isVirtualScroll && !_this.parent.enableRtl ? (getTranslateX(conTable) + 10) : 10;
10026
- _this.quickPopup.collision = { X: _this.parent.enableRtl ? 'flip' : 'none', Y: 'fit' };
10027
- _this.quickPopup.position = { X: _this.parent.enableRtl ? 'left' : 'right', Y: _this.parent.enableRtl ? 'bottom' : 'top' };
10028
- _this.quickPopup.dataBind();
10029
- _this.quickPopup.refreshPosition(null, true);
10030
- var collide = isCollide(_this.quickPopup.element, _this.parent.element);
10031
- if (collide.indexOf(_this.parent.enableRtl ? 'left' : 'right') > -1) {
10032
- _this.quickPopup.offsetX = -target.offsetWidth - 10 - _this.quickPopup.element.offsetWidth;
10033
- if (isVirtualScroll && !_this.parent.enableRtl) {
10034
- _this.quickPopup.offsetX = getTranslateX(conTable) + _this.quickPopup.offsetX;
10035
- }
10015
+ var display = _this.quickPopup.element.style.display;
10016
+ _this.quickPopup.element.style.display = 'block';
10017
+ if (_this.parent.isAdaptive) {
10018
+ _this.quickPopup.element.removeAttribute('style');
10019
+ _this.quickPopup.element.style.display = 'block';
10020
+ _this.quickPopup.element.style.height = formatUnit((popupType === 'EditEventInfo') ? 65 : window.innerHeight);
10021
+ }
10022
+ else {
10023
+ var isVirtualScroll = _this.parent.virtualScrollModule && _this.parent.virtualScrollModule.isHorizontalScroll
10024
+ && !isNullOrUndefined(closest(target, '.' + CONTENT_TABLE_CLASS));
10025
+ var conTable = _this.parent.element.querySelector('.' + CONTENT_WRAP_CLASS + ' table');
10026
+ _this.quickPopup.offsetX = isVirtualScroll && !_this.parent.enableRtl ? (getTranslateX(conTable) + 10) : 10;
10027
+ _this.quickPopup.offsetY = _this.parent.virtualScrollModule && !_this.parent.virtualScrollModule.isHorizontalScroll ?
10028
+ _this.quickPopup.offsetY : 0;
10029
+ _this.quickPopup.collision = { X: _this.parent.enableRtl ? 'flip' : 'none', Y: 'fit' };
10030
+ _this.quickPopup.position = { X: _this.parent.enableRtl ? 'left' : 'right', Y: _this.parent.enableRtl ? 'bottom' : 'top' };
10036
10031
  _this.quickPopup.dataBind();
10037
10032
  _this.quickPopup.refreshPosition(null, true);
10038
- var leftCollide = isCollide(_this.quickPopup.element, _this.parent.element);
10039
- if (leftCollide.indexOf('left') > -1) {
10040
- _this.quickPopup.position = { X: 'center', Y: 'center' };
10041
- _this.quickPopup.collision = { X: 'fit', Y: 'fit' };
10042
- _this.quickPopup.offsetX = -(_this.quickPopup.element.offsetWidth / 2);
10033
+ var collide = isCollide(_this.quickPopup.element, _this.parent.element);
10034
+ if (collide.indexOf(_this.parent.enableRtl ? 'left' : 'right') > -1) {
10035
+ _this.quickPopup.offsetX = -target.offsetWidth - 10 - _this.quickPopup.element.offsetWidth;
10036
+ if (isVirtualScroll && !_this.parent.enableRtl) {
10037
+ _this.quickPopup.offsetX = getTranslateX(conTable) + _this.quickPopup.offsetX;
10038
+ }
10043
10039
  _this.quickPopup.dataBind();
10040
+ _this.quickPopup.refreshPosition(null, true);
10041
+ var leftCollide = isCollide(_this.quickPopup.element, _this.parent.element);
10042
+ if (leftCollide.indexOf('left') > -1) {
10043
+ _this.quickPopup.position = { X: 'center', Y: 'center' };
10044
+ _this.quickPopup.collision = { X: 'fit', Y: 'fit' };
10045
+ _this.quickPopup.offsetX = -(_this.quickPopup.element.offsetWidth / 2);
10046
+ _this.quickPopup.dataBind();
10047
+ }
10048
+ }
10049
+ if (_this.parent.virtualScrollModule && !_this.parent.virtualScrollModule.isHorizontalScroll && (collide.indexOf('top') > -1 || collide.indexOf('bottom') > -1)) {
10050
+ var translateY = getTranslateY(conTable);
10051
+ _this.quickPopup.offsetY = translateY;
10052
+ _this.quickPopup.dataBind();
10053
+ _this.quickPopup.refreshPosition(null, true);
10054
+ }
10055
+ if (_this.quickPopup.position.X === 'center' && _this.quickPopup.position.Y === 'center' && !isNullOrUndefined(originalEvent)) {
10056
+ var previousOffset = _this.quickPopup.offsetY;
10057
+ var collision = isCollide(target, _this.quickPopup.element);
10058
+ var popupRect = _this.quickPopup.element.getBoundingClientRect();
10059
+ if (collision.indexOf('top') > -1 || collision.indexOf('bottom') > -1) {
10060
+ if (popupRect.top <= originalEvent.clientY && originalEvent.clientY <= popupRect.top + popupRect.height) {
10061
+ _this.quickPopup.offsetY = previousOffset - popupRect.height - 10;
10062
+ _this.quickPopup.dataBind();
10063
+ collision = isCollide(_this.quickPopup.element, _this.parent.element);
10064
+ if (collision.indexOf('top') > -1) {
10065
+ _this.quickPopup.offsetY = previousOffset + originalEvent.offsetY;
10066
+ _this.quickPopup.dataBind();
10067
+ }
10068
+ }
10069
+ else if (isCollide(_this.quickPopup.element, _this.parent.element).indexOf('bottom') > -1) {
10070
+ _this.quickPopup.offsetY = previousOffset - originalEvent.offsetY - Math.ceil(popupRect.height) - 10;
10071
+ _this.quickPopup.dataBind();
10072
+ }
10073
+ }
10044
10074
  }
10045
10075
  }
10046
- if (_this.parent.virtualScrollModule && !_this.parent.virtualScrollModule.isHorizontalScroll && (collide.indexOf('top') > -1 || collide.indexOf('bottom') > -1)) {
10047
- var translateY = getTranslateY(conTable);
10048
- _this.quickPopup.offsetY = translateY;
10049
- _this.quickPopup.dataBind();
10076
+ if (isEventPopup) {
10077
+ _this.applyEventColor();
10050
10078
  }
10079
+ _this.quickPopup.element.style.display = display;
10080
+ _this.quickPopup.dataBind();
10081
+ _this.quickPopup.show();
10051
10082
  }
10052
- if (isEventPopup) {
10053
- _this.applyEventColor();
10054
- }
10055
- _this.quickPopup.element.style.display = display;
10056
- _this.quickPopup.dataBind();
10057
- _this.quickPopup.show();
10058
- }
10083
+ });
10059
10084
  });
10060
10085
  };
10061
10086
  QuickPopups.prototype.applyEventColor = function () {
@@ -11831,6 +11856,7 @@ var EventWindow = /** @__PURE__ @class */ (function () {
11831
11856
  return container;
11832
11857
  };
11833
11858
  EventWindow.prototype.renderFormElements = function (form, args) {
11859
+ var _this = this;
11834
11860
  if (!isNullOrUndefined(this.parent.editorTemplate)) {
11835
11861
  if (args) {
11836
11862
  if (this.recurrenceEditor) {
@@ -11847,8 +11873,9 @@ var EventWindow = /** @__PURE__ @class */ (function () {
11847
11873
  var templateId = this.parent.element.id + '_editorTemplate';
11848
11874
  var tempEle = [].slice.call(this.parent.getEditorTemplate()(args || {}, this.parent, 'editorTemplate', templateId, false));
11849
11875
  append(tempEle, form);
11850
- this.parent.renderTemplates();
11851
- this.applyFormValidation();
11876
+ this.parent.renderTemplates(function () {
11877
+ _this.applyFormValidation();
11878
+ });
11852
11879
  }
11853
11880
  else {
11854
11881
  form.appendChild(this.getDefaultEventWindowContent());
@@ -12794,7 +12821,9 @@ var EventWindow = /** @__PURE__ @class */ (function () {
12794
12821
  }
12795
12822
  }
12796
12823
  if (this.recurrenceEditor && this.recurrenceEditor.value && this.recurrenceEditor.value !== '') {
12797
- alertType = this.recurrenceValidation(eventObj[this.fields.startTime], eventObj[this.fields.endTime], alert);
12824
+ if (this.parent.currentAction !== 'EditOccurrence') {
12825
+ alertType = this.recurrenceValidation(eventObj[this.fields.startTime], eventObj[this.fields.endTime], alert);
12826
+ }
12798
12827
  var isShowAlert = true;
12799
12828
  if (alertType === 'seriesChangeAlert' && this.parent.uiStateValues.isIgnoreOccurrence) {
12800
12829
  isShowAlert = false;
@@ -13027,53 +13056,58 @@ var EventWindow = /** @__PURE__ @class */ (function () {
13027
13056
  if (isNullOrUndefined(index)) {
13028
13057
  return false;
13029
13058
  }
13059
+ var currentStartTime = new Date(+currentData[this.fields.startTime]);
13060
+ var currentEndTime = new Date(+currentData[this.fields.endTime]);
13061
+ if (index !== recurColl.length - 1) {
13062
+ var nextStartTime = new Date(+recurColl[index + 1][this.fields.startTime]);
13063
+ var nextEndTime = new Date(+recurColl[index + 1][this.fields.endTime]);
13064
+ }
13065
+ var lastEndTime = new Date(+recurColl[recurColl.length - 1][this.fields.endTime]);
13030
13066
  if (index === 0) {
13031
13067
  if (!isNullOrUndefined(recurColl[index + 1])) {
13032
- if (!(resetTime(new Date(+recurColl[index + 1][this.fields.startTime])).getTime() >
13033
- resetTime(new Date(+currentData[this.fields.endTime])).getTime()) &&
13034
- (resetTime(new Date(+recurColl[recurColl.length - 1][this.fields.endTime])).getTime() >=
13035
- resetTime(new Date(+currentData[this.fields.startTime])).getTime())) {
13036
- this.parent.quickPopup.openRecurrenceValidationAlert('sameDayAlert');
13068
+ if (!(nextStartTime.getTime() >= currentEndTime.getTime()) &&
13069
+ (resetTime(lastEndTime).getTime() >=
13070
+ resetTime(currentStartTime).getTime()) ||
13071
+ resetTime(lastEndTime).getTime() < resetTime(currentStartTime).getTime()) {
13072
+ this.parent.quickPopup.openRecurrenceValidationAlert('occurrenceAlert');
13037
13073
  return true;
13038
13074
  }
13039
- else if (resetTime(new Date(+recurColl[recurColl.length - 1][this.fields.endTime])).getTime() <
13040
- resetTime(new Date(+currentData[this.fields.startTime])).getTime()) {
13041
- this.parent.quickPopup.openRecurrenceValidationAlert('occurrenceAlert');
13075
+ else if (!(resetTime(currentStartTime).getTime() <
13076
+ resetTime(nextStartTime).getTime())) {
13077
+ this.parent.quickPopup.openRecurrenceValidationAlert('sameDayAlert');
13042
13078
  return true;
13043
13079
  }
13044
13080
  }
13045
13081
  return false;
13046
13082
  }
13047
13083
  else {
13084
+ var previousStartTime = new Date(+recurColl[index - 1][this.fields.startTime]);
13085
+ var previousEndTime = new Date(+recurColl[index - 1][this.fields.endTime]);
13048
13086
  if (index === recurColl.length - 1) {
13049
- if (!(resetTime(new Date(+recurColl[index - 1][this.fields.endTime])).getTime() <
13050
- resetTime(new Date(+currentData[this.fields.startTime])).getTime()) &&
13051
- (resetTime(new Date(+recurColl[(recurColl.length - 1) - index][this.fields.startTime])).getTime() <=
13052
- resetTime(new Date(+currentData[this.fields.endTime])).getTime())) {
13053
- this.parent.quickPopup.openRecurrenceValidationAlert('sameDayAlert');
13087
+ if (resetTime(new Date(+recurColl[(recurColl.length - 1) - index][this.fields.startTime])).getTime() >
13088
+ resetTime(currentStartTime).getTime()) {
13089
+ this.parent.quickPopup.openRecurrenceValidationAlert('occurrenceAlert');
13054
13090
  return true;
13055
13091
  }
13056
- else if (resetTime(new Date(+recurColl[(recurColl.length - 1) - index][this.fields.endTime])).getTime() >
13057
- resetTime(new Date(+currentData[this.fields.startTime])).getTime()) {
13058
- this.parent.quickPopup.openRecurrenceValidationAlert('occurrenceAlert');
13092
+ else if (!((previousEndTime.getTime() <= currentStartTime.getTime()) &&
13093
+ (resetTime(currentStartTime).getTime() > resetTime(previousStartTime).getTime()))) {
13094
+ this.parent.quickPopup.openRecurrenceValidationAlert('sameDayAlert');
13059
13095
  return true;
13060
13096
  }
13061
13097
  }
13062
- else if (!(((resetTime(new Date(+recurColl[index - 1][this.fields.endTime])).getTime() <
13063
- resetTime(new Date(+currentData[this.fields.startTime])).getTime()) ||
13064
- (resetTime(new Date(+recurColl[0][this.fields.startTime])).getTime() >
13065
- resetTime(new Date(+currentData[this.fields.startTime])).getTime())) &&
13066
- ((resetTime(new Date(+recurColl[index + 1][this.fields.startTime])).getTime() >
13067
- resetTime(new Date(+currentData[this.fields.endTime])).getTime()) ||
13068
- (resetTime(new Date(+recurColl[recurColl.length - 1][this.fields.endTime])).getTime() <
13069
- resetTime(new Date(+currentData[this.fields.startTime])).getTime())))) {
13098
+ else if (!(((resetTime(previousStartTime).getTime() < resetTime(currentStartTime).getTime()) ||
13099
+ resetTime(new Date(+recurColl[0][this.fields.startTime])).getTime() >
13100
+ resetTime(currentStartTime).getTime()) &&
13101
+ ((resetTime(nextStartTime).getTime() > resetTime(currentStartTime).getTime()) ||
13102
+ (lastEndTime.getTime() < currentStartTime.getTime())))) {
13070
13103
  this.parent.quickPopup.openRecurrenceValidationAlert('sameDayAlert');
13071
13104
  return true;
13072
13105
  }
13073
- else if ((resetTime(new Date(+recurColl[index + 1][this.fields.endTime])).getTime() <
13074
- resetTime(new Date(+currentData[this.fields.startTime])).getTime()) ||
13075
- (resetTime(new Date(+recurColl[index - 1][this.fields.startTime])).getTime() >
13076
- resetTime(new Date(+currentData[this.fields.endTime])).getTime())) {
13106
+ else if (!(previousEndTime.getTime() <= currentStartTime.getTime() && nextStartTime.getTime() >
13107
+ currentEndTime.getTime()) || (resetTime(nextEndTime).getTime() <
13108
+ resetTime(currentStartTime).getTime()) ||
13109
+ (resetTime(previousStartTime).getTime() > resetTime(currentEndTime).getTime()) ||
13110
+ !(resetTime(currentStartTime).getTime() < resetTime(nextStartTime).getTime())) {
13077
13111
  this.parent.quickPopup.openRecurrenceValidationAlert('occurrenceAlert');
13078
13112
  return true;
13079
13113
  }
@@ -16511,12 +16545,16 @@ var Schedule = /** @__PURE__ @class */ (function (_super) {
16511
16545
  /**
16512
16546
  * Method to render react templates
16513
16547
  *
16548
+ * @param {Function} callBack - specifies the callBack method
16514
16549
  * @returns {void}
16515
16550
  * @private
16516
16551
  */
16517
- Schedule.prototype.renderTemplates = function () {
16552
+ Schedule.prototype.renderTemplates = function (callback) {
16518
16553
  if (this.isReact) {
16519
- this.renderReactTemplates();
16554
+ this.renderReactTemplates(callback);
16555
+ }
16556
+ else if (callback) {
16557
+ callback();
16520
16558
  }
16521
16559
  };
16522
16560
  /**