@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.
@@ -9129,7 +9129,7 @@ class QuickPopups {
9129
9129
  if (deleteIcon) {
9130
9130
  this.renderButton('e-flat e-round e-small', ICON + ' ' + DELETE_ICON_CLASS, deleteAction, deleteIcon, this.deleteClick);
9131
9131
  }
9132
- this.beforeQuickPopupOpen(target);
9132
+ this.beforeQuickPopupOpen(target, e);
9133
9133
  }
9134
9134
  isCellBlocked(args) {
9135
9135
  const tempObj = {};
@@ -9216,7 +9216,7 @@ class QuickPopups {
9216
9216
  this.quickPopup.content = quickCellPopup;
9217
9217
  this.quickPopup.relateTo = target;
9218
9218
  this.quickPopup.dataBind();
9219
- this.beforeQuickPopupOpen(target);
9219
+ this.beforeQuickPopupOpen(target, args.event);
9220
9220
  }
9221
9221
  isSameEventClick(events) {
9222
9222
  const isSameTarget = this.quickPopup.relateTo === closest(events.element, '.' + APPOINTMENT_CLASS);
@@ -9293,7 +9293,7 @@ class QuickPopups {
9293
9293
  this.quickPopup.relateTo = this.parent.isAdaptive ? document.body :
9294
9294
  closest(events.element, '.' + APPOINTMENT_CLASS);
9295
9295
  this.quickPopup.dataBind();
9296
- this.beforeQuickPopupOpen(events.element);
9296
+ this.beforeQuickPopupOpen(events.element, events.originalEvent);
9297
9297
  }
9298
9298
  }
9299
9299
  getPopupHeader(headerType, headerData) {
@@ -9567,15 +9567,16 @@ class QuickPopups {
9567
9567
  this.morePopup.relateTo = closest(target, '.' + WORK_CELLS_CLASS);
9568
9568
  }
9569
9569
  }
9570
- this.parent.renderTemplates();
9571
- const eventProp = {
9572
- type: 'EventContainer', cancel: false,
9573
- element: this.morePopup.element, data: data
9574
- };
9575
- this.parent.trigger(popupOpen, eventProp, (popupArgs) => {
9576
- if (!popupArgs.cancel) {
9577
- this.morePopup.show();
9578
- }
9570
+ this.parent.renderTemplates(() => {
9571
+ const eventProp = {
9572
+ type: 'EventContainer', cancel: false,
9573
+ element: this.morePopup.element, data: data
9574
+ };
9575
+ this.parent.trigger(popupOpen, eventProp, (popupArgs) => {
9576
+ if (!popupArgs.cancel) {
9577
+ this.morePopup.show();
9578
+ }
9579
+ });
9579
9580
  });
9580
9581
  }
9581
9582
  saveClick(event) {
@@ -9765,70 +9766,94 @@ class QuickPopups {
9765
9766
  }
9766
9767
  });
9767
9768
  }
9768
- beforeQuickPopupOpen(target) {
9769
- this.parent.renderTemplates();
9770
- const isEventPopup = this.quickPopup.element.querySelector('.' + EVENT_POPUP_CLASS);
9771
- const popupType = this.parent.isAdaptive ? isEventPopup ? 'ViewEventInfo' : 'EditEventInfo' : 'QuickInfo';
9772
- const eventProp = {
9773
- type: popupType, cancel: false, data: extend({}, this.getDataFromTarget(target), null, true),
9774
- target: target, element: this.quickPopup.element
9775
- };
9776
- this.parent.trigger(popupOpen, eventProp, (popupArgs) => {
9777
- if (popupArgs.cancel) {
9778
- this.quickPopupHide();
9779
- this.destroyPopupButtons('quickPopup');
9780
- if (popupArgs.element.classList.contains(POPUP_OPEN)) {
9781
- this.quickPopupClose();
9782
- }
9783
- removeChildren(this.quickPopup.element);
9784
- this.isMultipleEventSelect = false;
9785
- }
9786
- else {
9787
- const display = this.quickPopup.element.style.display;
9788
- this.quickPopup.element.style.display = 'block';
9789
- if (this.parent.isAdaptive) {
9790
- this.quickPopup.element.removeAttribute('style');
9791
- this.quickPopup.element.style.display = 'block';
9792
- this.quickPopup.element.style.height = formatUnit((popupType === 'EditEventInfo') ? 65 : window.innerHeight);
9769
+ beforeQuickPopupOpen(target, originalEvent) {
9770
+ this.parent.renderTemplates(() => {
9771
+ const isEventPopup = this.quickPopup.element.querySelector('.' + EVENT_POPUP_CLASS);
9772
+ const popupType = this.parent.isAdaptive ? isEventPopup ? 'ViewEventInfo' : 'EditEventInfo' : 'QuickInfo';
9773
+ const eventProp = {
9774
+ type: popupType, cancel: false, data: extend({}, this.getDataFromTarget(target), null, true),
9775
+ target: target, element: this.quickPopup.element
9776
+ };
9777
+ this.parent.trigger(popupOpen, eventProp, (popupArgs) => {
9778
+ if (popupArgs.cancel) {
9779
+ this.quickPopupHide();
9780
+ this.destroyPopupButtons('quickPopup');
9781
+ if (popupArgs.element.classList.contains(POPUP_OPEN)) {
9782
+ this.quickPopupClose();
9783
+ }
9784
+ removeChildren(this.quickPopup.element);
9785
+ this.isMultipleEventSelect = false;
9793
9786
  }
9794
9787
  else {
9795
- const isVirtualScroll = this.parent.virtualScrollModule && this.parent.virtualScrollModule.isHorizontalScroll
9796
- && !isNullOrUndefined(closest(target, '.' + CONTENT_TABLE_CLASS));
9797
- const conTable = this.parent.element.querySelector('.' + CONTENT_WRAP_CLASS + ' table');
9798
- this.quickPopup.offsetX = isVirtualScroll && !this.parent.enableRtl ? (getTranslateX(conTable) + 10) : 10;
9799
- this.quickPopup.collision = { X: this.parent.enableRtl ? 'flip' : 'none', Y: 'fit' };
9800
- this.quickPopup.position = { X: this.parent.enableRtl ? 'left' : 'right', Y: this.parent.enableRtl ? 'bottom' : 'top' };
9801
- this.quickPopup.dataBind();
9802
- this.quickPopup.refreshPosition(null, true);
9803
- const collide = isCollide(this.quickPopup.element, this.parent.element);
9804
- if (collide.indexOf(this.parent.enableRtl ? 'left' : 'right') > -1) {
9805
- this.quickPopup.offsetX = -target.offsetWidth - 10 - this.quickPopup.element.offsetWidth;
9806
- if (isVirtualScroll && !this.parent.enableRtl) {
9807
- this.quickPopup.offsetX = getTranslateX(conTable) + this.quickPopup.offsetX;
9808
- }
9788
+ const display = this.quickPopup.element.style.display;
9789
+ this.quickPopup.element.style.display = 'block';
9790
+ if (this.parent.isAdaptive) {
9791
+ this.quickPopup.element.removeAttribute('style');
9792
+ this.quickPopup.element.style.display = 'block';
9793
+ this.quickPopup.element.style.height = formatUnit((popupType === 'EditEventInfo') ? 65 : window.innerHeight);
9794
+ }
9795
+ else {
9796
+ const isVirtualScroll = this.parent.virtualScrollModule && this.parent.virtualScrollModule.isHorizontalScroll
9797
+ && !isNullOrUndefined(closest(target, '.' + CONTENT_TABLE_CLASS));
9798
+ const conTable = this.parent.element.querySelector('.' + CONTENT_WRAP_CLASS + ' table');
9799
+ this.quickPopup.offsetX = isVirtualScroll && !this.parent.enableRtl ? (getTranslateX(conTable) + 10) : 10;
9800
+ this.quickPopup.offsetY = this.parent.virtualScrollModule && !this.parent.virtualScrollModule.isHorizontalScroll ?
9801
+ this.quickPopup.offsetY : 0;
9802
+ this.quickPopup.collision = { X: this.parent.enableRtl ? 'flip' : 'none', Y: 'fit' };
9803
+ this.quickPopup.position = { X: this.parent.enableRtl ? 'left' : 'right', Y: this.parent.enableRtl ? 'bottom' : 'top' };
9809
9804
  this.quickPopup.dataBind();
9810
9805
  this.quickPopup.refreshPosition(null, true);
9811
- const leftCollide = isCollide(this.quickPopup.element, this.parent.element);
9812
- if (leftCollide.indexOf('left') > -1) {
9813
- this.quickPopup.position = { X: 'center', Y: 'center' };
9814
- this.quickPopup.collision = { X: 'fit', Y: 'fit' };
9815
- this.quickPopup.offsetX = -(this.quickPopup.element.offsetWidth / 2);
9806
+ const collide = isCollide(this.quickPopup.element, this.parent.element);
9807
+ if (collide.indexOf(this.parent.enableRtl ? 'left' : 'right') > -1) {
9808
+ this.quickPopup.offsetX = -target.offsetWidth - 10 - this.quickPopup.element.offsetWidth;
9809
+ if (isVirtualScroll && !this.parent.enableRtl) {
9810
+ this.quickPopup.offsetX = getTranslateX(conTable) + this.quickPopup.offsetX;
9811
+ }
9812
+ this.quickPopup.dataBind();
9813
+ this.quickPopup.refreshPosition(null, true);
9814
+ const leftCollide = isCollide(this.quickPopup.element, this.parent.element);
9815
+ if (leftCollide.indexOf('left') > -1) {
9816
+ this.quickPopup.position = { X: 'center', Y: 'center' };
9817
+ this.quickPopup.collision = { X: 'fit', Y: 'fit' };
9818
+ this.quickPopup.offsetX = -(this.quickPopup.element.offsetWidth / 2);
9819
+ this.quickPopup.dataBind();
9820
+ }
9821
+ }
9822
+ if (this.parent.virtualScrollModule && !this.parent.virtualScrollModule.isHorizontalScroll && (collide.indexOf('top') > -1 || collide.indexOf('bottom') > -1)) {
9823
+ const translateY = getTranslateY(conTable);
9824
+ this.quickPopup.offsetY = translateY;
9816
9825
  this.quickPopup.dataBind();
9826
+ this.quickPopup.refreshPosition(null, true);
9827
+ }
9828
+ if (this.quickPopup.position.X === 'center' && this.quickPopup.position.Y === 'center' && !isNullOrUndefined(originalEvent)) {
9829
+ const previousOffset = this.quickPopup.offsetY;
9830
+ let collision = isCollide(target, this.quickPopup.element);
9831
+ const popupRect = this.quickPopup.element.getBoundingClientRect();
9832
+ if (collision.indexOf('top') > -1 || collision.indexOf('bottom') > -1) {
9833
+ if (popupRect.top <= originalEvent.clientY && originalEvent.clientY <= popupRect.top + popupRect.height) {
9834
+ this.quickPopup.offsetY = previousOffset - popupRect.height - 10;
9835
+ this.quickPopup.dataBind();
9836
+ collision = isCollide(this.quickPopup.element, this.parent.element);
9837
+ if (collision.indexOf('top') > -1) {
9838
+ this.quickPopup.offsetY = previousOffset + originalEvent.offsetY;
9839
+ this.quickPopup.dataBind();
9840
+ }
9841
+ }
9842
+ else if (isCollide(this.quickPopup.element, this.parent.element).indexOf('bottom') > -1) {
9843
+ this.quickPopup.offsetY = previousOffset - originalEvent.offsetY - Math.ceil(popupRect.height) - 10;
9844
+ this.quickPopup.dataBind();
9845
+ }
9846
+ }
9817
9847
  }
9818
9848
  }
9819
- if (this.parent.virtualScrollModule && !this.parent.virtualScrollModule.isHorizontalScroll && (collide.indexOf('top') > -1 || collide.indexOf('bottom') > -1)) {
9820
- const translateY = getTranslateY(conTable);
9821
- this.quickPopup.offsetY = translateY;
9822
- this.quickPopup.dataBind();
9849
+ if (isEventPopup) {
9850
+ this.applyEventColor();
9823
9851
  }
9852
+ this.quickPopup.element.style.display = display;
9853
+ this.quickPopup.dataBind();
9854
+ this.quickPopup.show();
9824
9855
  }
9825
- if (isEventPopup) {
9826
- this.applyEventColor();
9827
- }
9828
- this.quickPopup.element.style.display = display;
9829
- this.quickPopup.dataBind();
9830
- this.quickPopup.show();
9831
- }
9856
+ });
9832
9857
  });
9833
9858
  }
9834
9859
  applyEventColor() {
@@ -11579,8 +11604,9 @@ class EventWindow {
11579
11604
  const templateId = this.parent.element.id + '_editorTemplate';
11580
11605
  const tempEle = [].slice.call(this.parent.getEditorTemplate()(args || {}, this.parent, 'editorTemplate', templateId, false));
11581
11606
  append(tempEle, form);
11582
- this.parent.renderTemplates();
11583
- this.applyFormValidation();
11607
+ this.parent.renderTemplates(() => {
11608
+ this.applyFormValidation();
11609
+ });
11584
11610
  }
11585
11611
  else {
11586
11612
  form.appendChild(this.getDefaultEventWindowContent());
@@ -12511,7 +12537,9 @@ class EventWindow {
12511
12537
  }
12512
12538
  }
12513
12539
  if (this.recurrenceEditor && this.recurrenceEditor.value && this.recurrenceEditor.value !== '') {
12514
- alertType = this.recurrenceValidation(eventObj[this.fields.startTime], eventObj[this.fields.endTime], alert);
12540
+ if (this.parent.currentAction !== 'EditOccurrence') {
12541
+ alertType = this.recurrenceValidation(eventObj[this.fields.startTime], eventObj[this.fields.endTime], alert);
12542
+ }
12515
12543
  let isShowAlert = true;
12516
12544
  if (alertType === 'seriesChangeAlert' && this.parent.uiStateValues.isIgnoreOccurrence) {
12517
12545
  isShowAlert = false;
@@ -12734,53 +12762,58 @@ class EventWindow {
12734
12762
  if (isNullOrUndefined(index)) {
12735
12763
  return false;
12736
12764
  }
12765
+ const currentStartTime = new Date(+currentData[this.fields.startTime]);
12766
+ const currentEndTime = new Date(+currentData[this.fields.endTime]);
12767
+ if (index !== recurColl.length - 1) {
12768
+ var nextStartTime = new Date(+recurColl[index + 1][this.fields.startTime]);
12769
+ var nextEndTime = new Date(+recurColl[index + 1][this.fields.endTime]);
12770
+ }
12771
+ const lastEndTime = new Date(+recurColl[recurColl.length - 1][this.fields.endTime]);
12737
12772
  if (index === 0) {
12738
12773
  if (!isNullOrUndefined(recurColl[index + 1])) {
12739
- if (!(resetTime(new Date(+recurColl[index + 1][this.fields.startTime])).getTime() >
12740
- resetTime(new Date(+currentData[this.fields.endTime])).getTime()) &&
12741
- (resetTime(new Date(+recurColl[recurColl.length - 1][this.fields.endTime])).getTime() >=
12742
- resetTime(new Date(+currentData[this.fields.startTime])).getTime())) {
12743
- this.parent.quickPopup.openRecurrenceValidationAlert('sameDayAlert');
12774
+ if (!(nextStartTime.getTime() >= currentEndTime.getTime()) &&
12775
+ (resetTime(lastEndTime).getTime() >=
12776
+ resetTime(currentStartTime).getTime()) ||
12777
+ resetTime(lastEndTime).getTime() < resetTime(currentStartTime).getTime()) {
12778
+ this.parent.quickPopup.openRecurrenceValidationAlert('occurrenceAlert');
12744
12779
  return true;
12745
12780
  }
12746
- else if (resetTime(new Date(+recurColl[recurColl.length - 1][this.fields.endTime])).getTime() <
12747
- resetTime(new Date(+currentData[this.fields.startTime])).getTime()) {
12748
- this.parent.quickPopup.openRecurrenceValidationAlert('occurrenceAlert');
12781
+ else if (!(resetTime(currentStartTime).getTime() <
12782
+ resetTime(nextStartTime).getTime())) {
12783
+ this.parent.quickPopup.openRecurrenceValidationAlert('sameDayAlert');
12749
12784
  return true;
12750
12785
  }
12751
12786
  }
12752
12787
  return false;
12753
12788
  }
12754
12789
  else {
12790
+ const previousStartTime = new Date(+recurColl[index - 1][this.fields.startTime]);
12791
+ const previousEndTime = new Date(+recurColl[index - 1][this.fields.endTime]);
12755
12792
  if (index === recurColl.length - 1) {
12756
- if (!(resetTime(new Date(+recurColl[index - 1][this.fields.endTime])).getTime() <
12757
- resetTime(new Date(+currentData[this.fields.startTime])).getTime()) &&
12758
- (resetTime(new Date(+recurColl[(recurColl.length - 1) - index][this.fields.startTime])).getTime() <=
12759
- resetTime(new Date(+currentData[this.fields.endTime])).getTime())) {
12760
- this.parent.quickPopup.openRecurrenceValidationAlert('sameDayAlert');
12793
+ if (resetTime(new Date(+recurColl[(recurColl.length - 1) - index][this.fields.startTime])).getTime() >
12794
+ resetTime(currentStartTime).getTime()) {
12795
+ this.parent.quickPopup.openRecurrenceValidationAlert('occurrenceAlert');
12761
12796
  return true;
12762
12797
  }
12763
- else if (resetTime(new Date(+recurColl[(recurColl.length - 1) - index][this.fields.endTime])).getTime() >
12764
- resetTime(new Date(+currentData[this.fields.startTime])).getTime()) {
12765
- this.parent.quickPopup.openRecurrenceValidationAlert('occurrenceAlert');
12798
+ else if (!((previousEndTime.getTime() <= currentStartTime.getTime()) &&
12799
+ (resetTime(currentStartTime).getTime() > resetTime(previousStartTime).getTime()))) {
12800
+ this.parent.quickPopup.openRecurrenceValidationAlert('sameDayAlert');
12766
12801
  return true;
12767
12802
  }
12768
12803
  }
12769
- else if (!(((resetTime(new Date(+recurColl[index - 1][this.fields.endTime])).getTime() <
12770
- resetTime(new Date(+currentData[this.fields.startTime])).getTime()) ||
12771
- (resetTime(new Date(+recurColl[0][this.fields.startTime])).getTime() >
12772
- resetTime(new Date(+currentData[this.fields.startTime])).getTime())) &&
12773
- ((resetTime(new Date(+recurColl[index + 1][this.fields.startTime])).getTime() >
12774
- resetTime(new Date(+currentData[this.fields.endTime])).getTime()) ||
12775
- (resetTime(new Date(+recurColl[recurColl.length - 1][this.fields.endTime])).getTime() <
12776
- resetTime(new Date(+currentData[this.fields.startTime])).getTime())))) {
12804
+ else if (!(((resetTime(previousStartTime).getTime() < resetTime(currentStartTime).getTime()) ||
12805
+ resetTime(new Date(+recurColl[0][this.fields.startTime])).getTime() >
12806
+ resetTime(currentStartTime).getTime()) &&
12807
+ ((resetTime(nextStartTime).getTime() > resetTime(currentStartTime).getTime()) ||
12808
+ (lastEndTime.getTime() < currentStartTime.getTime())))) {
12777
12809
  this.parent.quickPopup.openRecurrenceValidationAlert('sameDayAlert');
12778
12810
  return true;
12779
12811
  }
12780
- else if ((resetTime(new Date(+recurColl[index + 1][this.fields.endTime])).getTime() <
12781
- resetTime(new Date(+currentData[this.fields.startTime])).getTime()) ||
12782
- (resetTime(new Date(+recurColl[index - 1][this.fields.startTime])).getTime() >
12783
- resetTime(new Date(+currentData[this.fields.endTime])).getTime())) {
12812
+ else if (!(previousEndTime.getTime() <= currentStartTime.getTime() && nextStartTime.getTime() >
12813
+ currentEndTime.getTime()) || (resetTime(nextEndTime).getTime() <
12814
+ resetTime(currentStartTime).getTime()) ||
12815
+ (resetTime(previousStartTime).getTime() > resetTime(currentEndTime).getTime()) ||
12816
+ !(resetTime(currentStartTime).getTime() < resetTime(nextStartTime).getTime())) {
12784
12817
  this.parent.quickPopup.openRecurrenceValidationAlert('occurrenceAlert');
12785
12818
  return true;
12786
12819
  }
@@ -15899,12 +15932,16 @@ let Schedule = class Schedule extends Component {
15899
15932
  /**
15900
15933
  * Method to render react templates
15901
15934
  *
15935
+ * @param {Function} callBack - specifies the callBack method
15902
15936
  * @returns {void}
15903
15937
  * @private
15904
15938
  */
15905
- renderTemplates() {
15939
+ renderTemplates(callback) {
15906
15940
  if (this.isReact) {
15907
- this.renderReactTemplates();
15941
+ this.renderReactTemplates(callback);
15942
+ }
15943
+ else if (callback) {
15944
+ callback();
15908
15945
  }
15909
15946
  }
15910
15947
  /**