@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.
@@ -7629,10 +7629,32 @@ var VerticalEvent = /** @__PURE__ @class */ (function (_super) {
7629
7629
  if (this.parent.activeViewOptions.group.resources.length > 0) {
7630
7630
  this.overlapList = this.filterEventsByResource(this.resources[parseInt(resource.toString(), 10)], this.overlapList);
7631
7631
  }
7632
+ var queue_1 = [];
7632
7633
  this.overlapList.forEach(function (obj) {
7633
- var filterList = appointmentList_1.filter(function (data) {
7634
- return data[fieldMapping.endTime] > obj[fieldMapping.startTime] && data[fieldMapping.startTime] <= obj[fieldMapping.endTime];
7635
- });
7634
+ queue_1.push(obj);
7635
+ var filterList = [];
7636
+ var processedIds = new Set();
7637
+ var _loop_2 = function () {
7638
+ var currentObj = queue_1.shift();
7639
+ var overlaps = appointmentList_1.filter(function (data) {
7640
+ return data[fieldMapping.endTime] > currentObj[fieldMapping.startTime] &&
7641
+ data[fieldMapping.startTime] <= currentObj[fieldMapping.endTime] &&
7642
+ !processedIds.has(data[fieldMapping.id]);
7643
+ });
7644
+ overlaps.forEach(function (overlap) {
7645
+ filterList.push(overlap);
7646
+ processedIds.add(overlap[fieldMapping.id]);
7647
+ queue_1.push(overlap);
7648
+ });
7649
+ if (processedIds.size < appointmentList_1.length - 1) {
7650
+ return "break";
7651
+ }
7652
+ };
7653
+ while (queue_1.length > 0) {
7654
+ var state_1 = _loop_2();
7655
+ if (state_1 === "break")
7656
+ break;
7657
+ }
7636
7658
  if (_this.parent.activeViewOptions.group.resources.length > 0) {
7637
7659
  filterList = _this.filterEventsByResource(_this.resources[parseInt(resource.toString(), 10)], filterList);
7638
7660
  }
@@ -8465,7 +8487,7 @@ var MonthEvent = /** @__PURE__ @class */ (function (_super) {
8465
8487
  var _this = this;
8466
8488
  var eventType = appointmentElement.classList.contains(BLOCK_APPOINTMENT_CLASS) ? 'blockEvent' : 'event';
8467
8489
  var isAppointment = appointmentElement.classList.contains(APPOINTMENT_CLASS);
8468
- var eventObj = this.getEventData(event);
8490
+ var eventObj = this.parent.currentView === 'Month' ? this.getSpannedTime(event) : this.getEventData(event);
8469
8491
  var args = { data: eventObj, element: appointmentElement, cancel: false, type: eventType };
8470
8492
  this.parent.trigger(eventRendered, args, function (eventArgs) {
8471
8493
  if (eventArgs.cancel) {
@@ -8476,6 +8498,16 @@ var MonthEvent = /** @__PURE__ @class */ (function (_super) {
8476
8498
  }
8477
8499
  });
8478
8500
  };
8501
+ MonthEvent.prototype.getSpannedTime = function (event) {
8502
+ var eventObj = extend({}, event, null, true);
8503
+ if ((eventObj[this.fields.startTime]).getDate() === (eventObj.data[this.fields.startTime]).getDate()) {
8504
+ eventObj[this.fields.startTime] = eventObj.data[this.fields.startTime];
8505
+ }
8506
+ if ((eventObj[this.fields.endTime]).getDate() === (eventObj.data[this.fields.endTime]).getDate()) {
8507
+ eventObj[this.fields.endTime] = eventObj.data[this.fields.endTime];
8508
+ }
8509
+ return eventObj;
8510
+ };
8479
8511
  MonthEvent.prototype.getEventData = function (event) {
8480
8512
  var eventObj = extend({}, event, null, true);
8481
8513
  eventObj[this.fields.startTime] = event.data[this.fields.startTime];
@@ -9001,13 +9033,8 @@ var TimelineEvent = /** @__PURE__ @class */ (function (_super) {
9001
9033
  }
9002
9034
  };
9003
9035
  TimelineEvent.prototype.getSameDayEventsWidth = function (startDate, endDate) {
9004
- var intervalMins = this.interval;
9005
- if (this.slotsPerDay === 1) {
9006
- var hoursRange = getStartEndHours(resetTime(new Date(startDate.getTime())), this.startHour, this.endHour);
9007
- intervalMins = (hoursRange.endHour.getTime() - hoursRange.startHour.getTime()) / MS_PER_MINUTE;
9008
- }
9009
9036
  return ((getUniversalTime(endDate) - getUniversalTime(startDate)) /
9010
- MS_PER_MINUTE * (this.cellWidth * this.slotCount) / intervalMins);
9037
+ MS_PER_MINUTE * (this.cellWidth * this.slotCount) / this.getIntervalInMinutes(startDate));
9011
9038
  };
9012
9039
  TimelineEvent.prototype.getSpannedEventsWidth = function (startDate, endDate, diffInDays) {
9013
9040
  var width = (diffInDays * this.slotsPerDay) * this.cellWidth;
@@ -9033,13 +9060,13 @@ var TimelineEvent = /** @__PURE__ @class */ (function (_super) {
9033
9060
  TimelineEvent.prototype.getAppointmentLeft = function (schedule, startTime, day) {
9034
9061
  var slotTd = (this.isSameDay(startTime, schedule.startHour)) ?
9035
9062
  ((getUniversalTime(startTime) - getUniversalTime(schedule.startHour)) /
9036
- (MS_PER_MINUTE * this.interval)) * this.slotCount : 0;
9063
+ (MS_PER_MINUTE * this.getIntervalInMinutes(startTime))) * this.slotCount : 0;
9037
9064
  if (day === 0) {
9038
9065
  return slotTd;
9039
9066
  }
9040
9067
  else {
9041
9068
  var daySlot = Math.round((((getUniversalTime(schedule.endHour) - getUniversalTime(schedule.startHour)) /
9042
- MS_PER_MINUTE) / this.interval) * this.slotCount);
9069
+ MS_PER_MINUTE) / this.getIntervalInMinutes(startTime)) * this.slotCount);
9043
9070
  return (daySlot * day) + slotTd;
9044
9071
  }
9045
9072
  };
@@ -9072,6 +9099,13 @@ var TimelineEvent = /** @__PURE__ @class */ (function (_super) {
9072
9099
  return this.getFilteredEvents(startTime, endTime, gIndex, eventsList);
9073
9100
  }
9074
9101
  };
9102
+ TimelineEvent.prototype.getIntervalInMinutes = function (startDate) {
9103
+ if (this.slotsPerDay !== 1) {
9104
+ return this.interval;
9105
+ }
9106
+ var hoursRange = getStartEndHours(resetTime(new Date(startDate.getTime())), this.startHour, this.endHour);
9107
+ return (hoursRange.endHour.getTime() - hoursRange.startHour.getTime()) / MS_PER_MINUTE;
9108
+ };
9075
9109
  TimelineEvent.prototype.isAlreadyAvail = function (appPos, cellTd) {
9076
9110
  var moreIndicator = [].slice.call(cellTd.querySelectorAll('.' + MORE_INDICATOR_CLASS));
9077
9111
  for (var i = 0; i < moreIndicator.length; i++) {
@@ -13240,6 +13274,9 @@ var EventWindow = /** @__PURE__ @class */ (function () {
13240
13274
  else if (element.classList.contains('e-checkbox')) {
13241
13275
  fieldSelector = 'e-checkbox';
13242
13276
  }
13277
+ else if (element.classList.contains('e-numerictextbox')) {
13278
+ fieldSelector = 'e-numerictextbox';
13279
+ }
13243
13280
  var classSelector = isDropDowns ? "." + fieldSelector + ":not(.e-control)" : "." + fieldSelector;
13244
13281
  var control = closest(element, classSelector) || element.querySelector("." + fieldSelector);
13245
13282
  if (control) {
@@ -13989,6 +14026,9 @@ var EventWindow = /** @__PURE__ @class */ (function () {
13989
14026
  else if (element.classList.contains('e-checkbox')) {
13990
14027
  value = element.ej2_instances[0].checked;
13991
14028
  }
14029
+ else if (element.classList.contains('e-numerictextbox')) {
14030
+ value = element.ej2_instances[0].value;
14031
+ }
13992
14032
  else {
13993
14033
  if (element.type === 'checkbox') {
13994
14034
  value = element.checked;
@@ -14033,6 +14073,11 @@ var EventWindow = /** @__PURE__ @class */ (function () {
14033
14073
  instance.checked = value;
14034
14074
  instance.dataBind();
14035
14075
  }
14076
+ else if (element.classList.contains('e-numerictextbox')) {
14077
+ var instance = element.ej2_instances[0];
14078
+ instance.value = value;
14079
+ instance.dataBind();
14080
+ }
14036
14081
  else {
14037
14082
  if (element.type !== 'checkbox') {
14038
14083
  element.value = value || '';
@@ -14070,6 +14115,11 @@ var EventWindow = /** @__PURE__ @class */ (function () {
14070
14115
  instance.checked = false;
14071
14116
  instance.dataBind();
14072
14117
  }
14118
+ else if (element.classList.contains('e-numerictextbox')) {
14119
+ var instance = element.ej2_instances[0];
14120
+ instance.value = null;
14121
+ instance.dataBind();
14122
+ }
14073
14123
  else {
14074
14124
  if (element.type === 'checkbox') {
14075
14125
  element.checked = false;
@@ -19434,8 +19484,9 @@ var Schedule = /** @__PURE__ @class */ (function (_super) {
19434
19484
  var msMajorInterval = this.activeViewOptions.timeScale.interval * MS_PER_MINUTE;
19435
19485
  var msInterval = msMajorInterval / this.activeViewOptions.timeScale.slotCount;
19436
19486
  var offsetDiff = ((viewStartHour.getTimezoneOffset() - startHour.getTimezoneOffset()) * MS_PER_MINUTE);
19487
+ var endOffsetDiff = Math.abs((viewStartHour.getTimezoneOffset() - endHour.getTimezoneOffset()) * MS_PER_MINUTE);
19437
19488
  var startIndex = Math.round((startHour.getTime() - viewStartHour.getTime() + offsetDiff) / msInterval);
19438
- var endIndex = Math.ceil((endHour.getTime() - viewStartHour.getTime() + offsetDiff) / msInterval);
19489
+ var endIndex = Math.ceil((endHour.getTime() - viewStartHour.getTime() - endOffsetDiff) / msInterval);
19439
19490
  var tempStartIndex = startIndex;
19440
19491
  var tempEndIndex = endIndex;
19441
19492
  var cells = [];
@@ -21431,11 +21482,8 @@ var Resize = /** @__PURE__ @class */ (function (_super) {
21431
21482
  var eventStart = new Date(this.actionObj.event[this.parent.eventFields.startTime].getTime());
21432
21483
  var eventEnd = new Date(this.actionObj.event[this.parent.eventFields.endTime].getTime());
21433
21484
  var resizeTime;
21434
- var isDateHeader = false;
21435
21485
  var headerName = this.parent.currentView;
21436
- var isTimeViews = ['TimelineDay', 'TimelineWeek', 'TimelineWorkWeek'].indexOf(this.parent.currentView) > -1;
21437
21486
  var isTimelineMonth = this.parent.currentView === 'TimelineMonth';
21438
- var isWithoutScale = isTimelineMonth || isTimeViews && !this.parent.activeViewOptions.timeScale.enable;
21439
21487
  if (this.parent.activeView.isTimelineView()) {
21440
21488
  var tr = this.parent.getContentTable().querySelector('tr');
21441
21489
  if (this.parent.activeViewOptions.headerRows.length > 0) {
@@ -21468,7 +21516,6 @@ var Resize = /** @__PURE__ @class */ (function (_super) {
21468
21516
  }
21469
21517
  cellIndex = !isTimelineMonth ? Math.round(offsetValue / (this.parent.getElementWidth(tr) / noOfDays)) :
21470
21518
  Math.floor(offsetValue / Math.floor(this.parent.getElementWidth(tr) / noOfDays));
21471
- isDateHeader = isTimeViews && headerName === 'Date';
21472
21519
  cellIndex = isLeft ? cellIndex : isTimelineMonth ? cellIndex + 1 : cellIndex;
21473
21520
  isLastCell = cellIndex === tdCollections.length;
21474
21521
  cellIndex = (cellIndex < 0) ? 0 : (cellIndex >= noOfDays) ? noOfDays - 1 : cellIndex;
@@ -21534,15 +21581,14 @@ var Resize = /** @__PURE__ @class */ (function (_super) {
21534
21581
  !this.parent.activeViewOptions.timeScale.enable;
21535
21582
  if (isLeft) {
21536
21583
  if ((eventEnd.getTime() - resizeTime.getTime()) <= 0) {
21537
- resizeTime = isWithoutScale ? resetTime(eventEnd) : eventStart;
21584
+ resizeTime = isNotHourSlot ? resetTime(eventEnd) : eventStart;
21538
21585
  }
21539
21586
  this.actionObj.start = !isNotHourSlot ? this.calculateIntervalTime(resizeTime) : resizeTime;
21540
21587
  }
21541
21588
  else {
21542
- var isTimeScaleViews = isTimeViews && this.parent.activeViewOptions.timeScale.enable;
21543
- var resizeEnd = ((!isTimeScaleViews || isDateHeader || isTimeViews && ['Week', 'Month', 'Year'].indexOf(headerName) > -1)
21544
- && resizeTime.getHours() === 0 && resizeTime.getMinutes() === 0) ? addDays(resizeTime, 1) : resizeTime;
21545
- if (isWithoutScale && (resizeEnd.getTime() - eventStart.getTime()) <= 0) {
21589
+ var resizeEnd = (isNotHourSlot && resizeTime.getHours() === 0 && resizeTime.getMinutes() === 0) ?
21590
+ addDays(resizeTime, 1) : resizeTime;
21591
+ if (isNotHourSlot && (resizeEnd.getTime() - eventStart.getTime()) <= 0) {
21546
21592
  resizeEnd = addDays(resetTime(eventStart), 1);
21547
21593
  }
21548
21594
  this.actionObj.end = !isNotHourSlot ? this.calculateIntervalTime(resizeEnd) : resizeEnd;