@syncfusion/ej2-schedule 27.1.52 → 27.1.55

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.
@@ -7469,8 +7469,27 @@ class VerticalEvent extends EventBase {
7469
7469
  if (this.parent.activeViewOptions.group.resources.length > 0) {
7470
7470
  this.overlapList = this.filterEventsByResource(this.resources[parseInt(resource.toString(), 10)], this.overlapList);
7471
7471
  }
7472
+ const queue = [];
7472
7473
  this.overlapList.forEach((obj) => {
7473
- let filterList = appointmentList.filter((data) => data[fieldMapping.endTime] > obj[fieldMapping.startTime] && data[fieldMapping.startTime] <= obj[fieldMapping.endTime]);
7474
+ queue.push(obj);
7475
+ let filterList = [];
7476
+ const processedIds = new Set();
7477
+ while (queue.length > 0) {
7478
+ const currentObj = queue.shift();
7479
+ const overlaps = appointmentList.filter((data) => {
7480
+ return data[fieldMapping.endTime] > currentObj[fieldMapping.startTime] &&
7481
+ data[fieldMapping.startTime] <= currentObj[fieldMapping.endTime] &&
7482
+ !processedIds.has(data[fieldMapping.id]);
7483
+ });
7484
+ overlaps.forEach((overlap) => {
7485
+ filterList.push(overlap);
7486
+ processedIds.add(overlap[fieldMapping.id]);
7487
+ queue.push(overlap);
7488
+ });
7489
+ if (processedIds.size < appointmentList.length - 1) {
7490
+ break;
7491
+ }
7492
+ }
7474
7493
  if (this.parent.activeViewOptions.group.resources.length > 0) {
7475
7494
  filterList = this.filterEventsByResource(this.resources[parseInt(resource.toString(), 10)], filterList);
7476
7495
  }
@@ -8270,7 +8289,7 @@ class MonthEvent extends EventBase {
8270
8289
  renderEventElement(event, appointmentElement, cellTd) {
8271
8290
  const eventType = appointmentElement.classList.contains(BLOCK_APPOINTMENT_CLASS) ? 'blockEvent' : 'event';
8272
8291
  const isAppointment = appointmentElement.classList.contains(APPOINTMENT_CLASS);
8273
- const eventObj = this.getEventData(event);
8292
+ const eventObj = this.parent.currentView === 'Month' ? this.getSpannedTime(event) : this.getEventData(event);
8274
8293
  const args = { data: eventObj, element: appointmentElement, cancel: false, type: eventType };
8275
8294
  this.parent.trigger(eventRendered, args, (eventArgs) => {
8276
8295
  if (eventArgs.cancel) {
@@ -8281,6 +8300,16 @@ class MonthEvent extends EventBase {
8281
8300
  }
8282
8301
  });
8283
8302
  }
8303
+ getSpannedTime(event) {
8304
+ const eventObj = extend({}, event, null, true);
8305
+ if ((eventObj[this.fields.startTime]).getDate() === (eventObj.data[this.fields.startTime]).getDate()) {
8306
+ eventObj[this.fields.startTime] = eventObj.data[this.fields.startTime];
8307
+ }
8308
+ if ((eventObj[this.fields.endTime]).getDate() === (eventObj.data[this.fields.endTime]).getDate()) {
8309
+ eventObj[this.fields.endTime] = eventObj.data[this.fields.endTime];
8310
+ }
8311
+ return eventObj;
8312
+ }
8284
8313
  getEventData(event) {
8285
8314
  const eventObj = extend({}, event, null, true);
8286
8315
  eventObj[this.fields.startTime] = event.data[this.fields.startTime];
@@ -8779,13 +8808,8 @@ class TimelineEvent extends MonthEvent {
8779
8808
  }
8780
8809
  }
8781
8810
  getSameDayEventsWidth(startDate, endDate) {
8782
- let intervalMins = this.interval;
8783
- if (this.slotsPerDay === 1) {
8784
- const hoursRange = getStartEndHours(resetTime(new Date(startDate.getTime())), this.startHour, this.endHour);
8785
- intervalMins = (hoursRange.endHour.getTime() - hoursRange.startHour.getTime()) / MS_PER_MINUTE;
8786
- }
8787
8811
  return ((getUniversalTime(endDate) - getUniversalTime(startDate)) /
8788
- MS_PER_MINUTE * (this.cellWidth * this.slotCount) / intervalMins);
8812
+ MS_PER_MINUTE * (this.cellWidth * this.slotCount) / this.getIntervalInMinutes(startDate));
8789
8813
  }
8790
8814
  getSpannedEventsWidth(startDate, endDate, diffInDays) {
8791
8815
  const width = (diffInDays * this.slotsPerDay) * this.cellWidth;
@@ -8811,13 +8835,13 @@ class TimelineEvent extends MonthEvent {
8811
8835
  getAppointmentLeft(schedule, startTime, day) {
8812
8836
  const slotTd = (this.isSameDay(startTime, schedule.startHour)) ?
8813
8837
  ((getUniversalTime(startTime) - getUniversalTime(schedule.startHour)) /
8814
- (MS_PER_MINUTE * this.interval)) * this.slotCount : 0;
8838
+ (MS_PER_MINUTE * this.getIntervalInMinutes(startTime))) * this.slotCount : 0;
8815
8839
  if (day === 0) {
8816
8840
  return slotTd;
8817
8841
  }
8818
8842
  else {
8819
8843
  const daySlot = Math.round((((getUniversalTime(schedule.endHour) - getUniversalTime(schedule.startHour)) /
8820
- MS_PER_MINUTE) / this.interval) * this.slotCount);
8844
+ MS_PER_MINUTE) / this.getIntervalInMinutes(startTime)) * this.slotCount);
8821
8845
  return (daySlot * day) + slotTd;
8822
8846
  }
8823
8847
  }
@@ -8850,6 +8874,13 @@ class TimelineEvent extends MonthEvent {
8850
8874
  return this.getFilteredEvents(startTime, endTime, gIndex, eventsList);
8851
8875
  }
8852
8876
  }
8877
+ getIntervalInMinutes(startDate) {
8878
+ if (this.slotsPerDay !== 1) {
8879
+ return this.interval;
8880
+ }
8881
+ const hoursRange = getStartEndHours(resetTime(new Date(startDate.getTime())), this.startHour, this.endHour);
8882
+ return (hoursRange.endHour.getTime() - hoursRange.startHour.getTime()) / MS_PER_MINUTE;
8883
+ }
8853
8884
  isAlreadyAvail(appPos, cellTd) {
8854
8885
  const moreIndicator = [].slice.call(cellTd.querySelectorAll('.' + MORE_INDICATOR_CLASS));
8855
8886
  for (let i = 0; i < moreIndicator.length; i++) {
@@ -12937,6 +12968,9 @@ class EventWindow {
12937
12968
  else if (element.classList.contains('e-checkbox')) {
12938
12969
  fieldSelector = 'e-checkbox';
12939
12970
  }
12971
+ else if (element.classList.contains('e-numerictextbox')) {
12972
+ fieldSelector = 'e-numerictextbox';
12973
+ }
12940
12974
  const classSelector = isDropDowns ? `.${fieldSelector}:not(.e-control)` : `.${fieldSelector}`;
12941
12975
  const control = closest(element, classSelector) || element.querySelector(`.${fieldSelector}`);
12942
12976
  if (control) {
@@ -13667,6 +13701,9 @@ class EventWindow {
13667
13701
  else if (element.classList.contains('e-checkbox')) {
13668
13702
  value = element.ej2_instances[0].checked;
13669
13703
  }
13704
+ else if (element.classList.contains('e-numerictextbox')) {
13705
+ value = element.ej2_instances[0].value;
13706
+ }
13670
13707
  else {
13671
13708
  if (element.type === 'checkbox') {
13672
13709
  value = element.checked;
@@ -13711,6 +13748,11 @@ class EventWindow {
13711
13748
  instance.checked = value;
13712
13749
  instance.dataBind();
13713
13750
  }
13751
+ else if (element.classList.contains('e-numerictextbox')) {
13752
+ const instance = element.ej2_instances[0];
13753
+ instance.value = value;
13754
+ instance.dataBind();
13755
+ }
13714
13756
  else {
13715
13757
  if (element.type !== 'checkbox') {
13716
13758
  element.value = value || '';
@@ -13748,6 +13790,11 @@ class EventWindow {
13748
13790
  instance.checked = false;
13749
13791
  instance.dataBind();
13750
13792
  }
13793
+ else if (element.classList.contains('e-numerictextbox')) {
13794
+ const instance = element.ej2_instances[0];
13795
+ instance.value = null;
13796
+ instance.dataBind();
13797
+ }
13751
13798
  else {
13752
13799
  if (element.type === 'checkbox') {
13753
13800
  element.checked = false;
@@ -18764,8 +18811,9 @@ let Schedule = class Schedule extends Component {
18764
18811
  const msMajorInterval = this.activeViewOptions.timeScale.interval * MS_PER_MINUTE;
18765
18812
  const msInterval = msMajorInterval / this.activeViewOptions.timeScale.slotCount;
18766
18813
  const offsetDiff = ((viewStartHour.getTimezoneOffset() - startHour.getTimezoneOffset()) * MS_PER_MINUTE);
18814
+ const endOffsetDiff = Math.abs((viewStartHour.getTimezoneOffset() - endHour.getTimezoneOffset()) * MS_PER_MINUTE);
18767
18815
  let startIndex = Math.round((startHour.getTime() - viewStartHour.getTime() + offsetDiff) / msInterval);
18768
- let endIndex = Math.ceil((endHour.getTime() - viewStartHour.getTime() + offsetDiff) / msInterval);
18816
+ let endIndex = Math.ceil((endHour.getTime() - viewStartHour.getTime() - endOffsetDiff) / msInterval);
18769
18817
  const tempStartIndex = startIndex;
18770
18818
  const tempEndIndex = endIndex;
18771
18819
  const cells = [];
@@ -20708,11 +20756,8 @@ class Resize extends ActionBase {
20708
20756
  const eventStart = new Date(this.actionObj.event[this.parent.eventFields.startTime].getTime());
20709
20757
  const eventEnd = new Date(this.actionObj.event[this.parent.eventFields.endTime].getTime());
20710
20758
  let resizeTime;
20711
- let isDateHeader = false;
20712
20759
  let headerName = this.parent.currentView;
20713
- const isTimeViews = ['TimelineDay', 'TimelineWeek', 'TimelineWorkWeek'].indexOf(this.parent.currentView) > -1;
20714
20760
  const isTimelineMonth = this.parent.currentView === 'TimelineMonth';
20715
- const isWithoutScale = isTimelineMonth || isTimeViews && !this.parent.activeViewOptions.timeScale.enable;
20716
20761
  if (this.parent.activeView.isTimelineView()) {
20717
20762
  const tr = this.parent.getContentTable().querySelector('tr');
20718
20763
  if (this.parent.activeViewOptions.headerRows.length > 0) {
@@ -20744,7 +20789,6 @@ class Resize extends ActionBase {
20744
20789
  }
20745
20790
  cellIndex = !isTimelineMonth ? Math.round(offsetValue / (this.parent.getElementWidth(tr) / noOfDays)) :
20746
20791
  Math.floor(offsetValue / Math.floor(this.parent.getElementWidth(tr) / noOfDays));
20747
- isDateHeader = isTimeViews && headerName === 'Date';
20748
20792
  cellIndex = isLeft ? cellIndex : isTimelineMonth ? cellIndex + 1 : cellIndex;
20749
20793
  isLastCell = cellIndex === tdCollections.length;
20750
20794
  cellIndex = (cellIndex < 0) ? 0 : (cellIndex >= noOfDays) ? noOfDays - 1 : cellIndex;
@@ -20810,15 +20854,14 @@ class Resize extends ActionBase {
20810
20854
  !this.parent.activeViewOptions.timeScale.enable;
20811
20855
  if (isLeft) {
20812
20856
  if ((eventEnd.getTime() - resizeTime.getTime()) <= 0) {
20813
- resizeTime = isWithoutScale ? resetTime(eventEnd) : eventStart;
20857
+ resizeTime = isNotHourSlot ? resetTime(eventEnd) : eventStart;
20814
20858
  }
20815
20859
  this.actionObj.start = !isNotHourSlot ? this.calculateIntervalTime(resizeTime) : resizeTime;
20816
20860
  }
20817
20861
  else {
20818
- const isTimeScaleViews = isTimeViews && this.parent.activeViewOptions.timeScale.enable;
20819
- let resizeEnd = ((!isTimeScaleViews || isDateHeader || isTimeViews && ['Week', 'Month', 'Year'].indexOf(headerName) > -1)
20820
- && resizeTime.getHours() === 0 && resizeTime.getMinutes() === 0) ? addDays(resizeTime, 1) : resizeTime;
20821
- if (isWithoutScale && (resizeEnd.getTime() - eventStart.getTime()) <= 0) {
20862
+ let resizeEnd = (isNotHourSlot && resizeTime.getHours() === 0 && resizeTime.getMinutes() === 0) ?
20863
+ addDays(resizeTime, 1) : resizeTime;
20864
+ if (isNotHourSlot && (resizeEnd.getTime() - eventStart.getTime()) <= 0) {
20822
20865
  resizeEnd = addDays(resetTime(eventStart), 1);
20823
20866
  }
20824
20867
  this.actionObj.end = !isNotHourSlot ? this.calculateIntervalTime(resizeEnd) : resizeEnd;