@syncfusion/ej2-schedule 27.1.50 → 27.1.52

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.
@@ -2009,6 +2009,9 @@ class ScheduleTouch {
2009
2009
  this.element.style.transform = 'translatex(' + (this.parent.enableRtl ? prevWidth : -this.currentPanel.element.offsetLeft) + 'px)';
2010
2010
  }
2011
2011
  onTransitionEnd() {
2012
+ if (!isNullOrUndefined(this.element) && !this.element.classList.contains(TRANSLATE_CLASS)) {
2013
+ return;
2014
+ }
2012
2015
  removeClass([this.element], TRANSLATE_CLASS);
2013
2016
  this.element.style.transitionDuration = '';
2014
2017
  this.element.style.transform = '';
@@ -6837,8 +6840,8 @@ class VerticalEvent extends EventBase {
6837
6840
  this.slotCount = this.parent.activeViewOptions.timeScale.slotCount;
6838
6841
  this.interval = this.parent.activeViewOptions.timeScale.interval;
6839
6842
  this.allDayLevel = 0;
6840
- this.startHour = this.parent.activeView.getStartHour();
6841
- this.endHour = this.parent.activeView.getEndHour();
6843
+ this.startHour = this.getStartEndHours(this.parent.activeViewOptions.startHour);
6844
+ this.endHour = this.getStartEndHours(this.parent.activeViewOptions.endHour);
6842
6845
  this.element = this.parent.activeView.getPanel();
6843
6846
  this.fields = this.parent.eventFields;
6844
6847
  this.animation = new Animation({ progress: this.animationUiUpdate.bind(this) });
@@ -6966,7 +6969,7 @@ class VerticalEvent extends EventBase {
6966
6969
  const renderDates = this.dateRender[parseInt(resource.toString(), 10)];
6967
6970
  for (let day = 0, length = renderDates.length; day < length; day++) {
6968
6971
  const startDate = new Date(renderDates[parseInt(day.toString(), 10)].getTime());
6969
- const endDate = addDays(renderDates[parseInt(day.toString(), 10)], 1);
6972
+ const endDate = resetTime(addDays(renderDates[parseInt(day.toString(), 10)], 1));
6970
6973
  const filterEvents = this.filterEvents(startDate, endDate, this.parent.blockProcessed, this.resources[parseInt(resource.toString(), 10)]);
6971
6974
  for (const event of filterEvents) {
6972
6975
  if (this.parent.resourceBase) {
@@ -6996,7 +6999,7 @@ class VerticalEvent extends EventBase {
6996
6999
  }
6997
7000
  else {
6998
7001
  blockHeight = formatUnit(this.getHeight(eStart, eEnd));
6999
- blockTop = formatUnit(this.getTopValue(eStart, dayIndex, resource));
7002
+ blockTop = formatUnit(this.getTopValue(eStart));
7000
7003
  }
7001
7004
  const appointmentElement = this.createBlockAppointmentElement(eventObj, resource, this.isResourceEventTemplate);
7002
7005
  setStyleAttribute(appointmentElement, { 'width': '100%', 'height': blockHeight, 'top': blockTop });
@@ -7029,7 +7032,7 @@ class VerticalEvent extends EventBase {
7029
7032
  renderDates[parseInt(day.toString(), 10)] <= renderedDate[renderedDate.length - 1]; day++) {
7030
7033
  this.renderedEvents = [];
7031
7034
  const startDate = new Date(renderDates[parseInt(day.toString(), 10)].getTime());
7032
- const endDate = addDays(renderDates[parseInt(day.toString(), 10)], 1);
7035
+ const endDate = resetTime(addDays(renderDates[parseInt(day.toString(), 10)], 1));
7033
7036
  const filterEvents = this.filterEvents(startDate, endDate, eventCollection, this.resources[parseInt(resource.toString(), 10)]);
7034
7037
  if (isRender) {
7035
7038
  for (const event of filterEvents) {
@@ -7361,7 +7364,7 @@ class VerticalEvent extends EventBase {
7361
7364
  if (eStart <= eEnd && isValidEvent && this.isWorkDayAvailable(resource, eStart)) {
7362
7365
  const appHeight = record.isSpanned.isSameDuration ? this.cellHeight : this.getHeight(eStart, eEnd);
7363
7366
  if (eStart.getTime() >= schedule.startHour.getTime()) {
7364
- topValue = this.getTopValue(eStart, dayIndex, resource);
7367
+ topValue = this.getTopValue(eStart);
7365
7368
  }
7366
7369
  const appIndex = this.getOverlapIndex(record, dayIndex, false, resource);
7367
7370
  record.Index = appIndex;
@@ -7422,13 +7425,20 @@ class VerticalEvent extends EventBase {
7422
7425
  const tempLeft = (parseFloat(appWidth) + 1) * index;
7423
7426
  return (tempLeft > 99 ? 99 : tempLeft) + '%';
7424
7427
  }
7425
- getTopValue(date, day, resource) {
7426
- const viewDate = resetTime(this.dateRender[parseInt(resource.toString(), 10)][parseInt(day.toString(), 10)]);
7427
- const startEndHours = getStartEndHours(viewDate, this.startHour, this.endHour);
7428
- const startHour = startEndHours.startHour;
7429
- const adjustedStartHour = isDaylightSavingTime(viewDate) && (startHour.getHours() !== this.startHour.getHours()) ?
7430
- this.startHour.getHours() : startHour.getHours();
7431
- const diffInMinutes = ((date.getHours() - adjustedStartHour) * 60) + (date.getMinutes() - startHour.getMinutes());
7428
+ getStartEndHours(startEndTime) {
7429
+ if (!isNullOrUndefined(startEndTime) && startEndTime !== '') {
7430
+ const startEndDate = new Date(2000, 0, 0, 0);
7431
+ const timeString = startEndTime.split(':');
7432
+ if (timeString.length === 2) {
7433
+ startEndDate.setHours(parseInt(timeString[0], 10), parseInt(timeString[1], 10), 0);
7434
+ }
7435
+ return startEndDate;
7436
+ }
7437
+ return null;
7438
+ }
7439
+ getTopValue(date) {
7440
+ const startHour = this.getStartEndHours(this.parent.activeViewOptions.startHour);
7441
+ const diffInMinutes = ((date.getHours() - startHour.getHours()) * 60) + (date.getMinutes() - startHour.getMinutes());
7432
7442
  return (this.parent.activeViewOptions.timeScale.enable) ? ((diffInMinutes * this.cellHeight * this.slotCount) / this.interval) : 0;
7433
7443
  }
7434
7444
  getOverlapIndex(record, day, isAllDay, resource) {
@@ -10790,7 +10800,7 @@ class EventTooltip {
10790
10800
  this.parent.resetTemplates(['tooltipTemplate', 'headerTooltipTemplate']);
10791
10801
  }
10792
10802
  setContent(content) {
10793
- this.tooltipObj.setProperties({ content: content }, true);
10803
+ this.tooltipObj.setProperties({ content: content, windowCollision: true }, true);
10794
10804
  }
10795
10805
  close() {
10796
10806
  this.tooltipObj.close();
@@ -21562,13 +21572,16 @@ class DragAndDrop extends ActionBase {
21562
21572
  this.isCursorAhead = false;
21563
21573
  this.enableCurrentViewDrag = false;
21564
21574
  this.isPreventMultiDrag = false;
21575
+ this.slotsUptoCursor = -1;
21576
+ this.eleTop = 0;
21565
21577
  }
21566
21578
  wireDragEvent(element) {
21579
+ const isVerticalView = ['Day', 'Week', 'WorkWeek'].indexOf(this.parent.currentView) > -1;
21567
21580
  new Draggable(element, {
21568
21581
  abort: '.' + EVENT_RESIZE_CLASS,
21569
21582
  clone: true,
21570
21583
  isDragScroll: true,
21571
- enableTailMode: (this.parent.eventDragArea) ? true : false,
21584
+ enableTailMode: (this.parent.eventDragArea || isVerticalView) ? true : false,
21572
21585
  cursorAt: (this.parent.eventDragArea) ? { left: -20, top: -20 } : { left: 0, top: 0 },
21573
21586
  dragArea: this.dragArea,
21574
21587
  dragStart: this.dragStart.bind(this),
@@ -21591,6 +21604,8 @@ class DragAndDrop extends ActionBase {
21591
21604
  }
21592
21605
  this.setDragActionDefaultValues();
21593
21606
  this.actionObj.element = e.element;
21607
+ this.eleTop = parseFloat(this.actionObj.element.style.top);
21608
+ this.slotsUptoCursor = -1;
21594
21609
  this.actionObj.action = 'drag';
21595
21610
  let elements = [];
21596
21611
  if (!this.parent.allowMultiDrag || isNullOrUndefined(this.parent.selectedElements) || this.parent.selectedElements.length === 0 ||
@@ -21669,7 +21684,13 @@ class DragAndDrop extends ActionBase {
21669
21684
  }
21670
21685
  let top = parseInt(e.top, 10);
21671
21686
  top = top < 0 ? 0 : top;
21672
- topValue = formatUnit(Math.floor(top / cellHeight) * cellHeight);
21687
+ if (this.slotsUptoCursor < 0) {
21688
+ const cellsCountUptoCursor = Math.floor(top / cellHeight);
21689
+ const cellsCountUptoEleTop = Math.floor(this.eleTop / cellHeight);
21690
+ this.slotsUptoCursor = cellsCountUptoCursor - cellsCountUptoEleTop;
21691
+ }
21692
+ top = (Math.floor((top + 1) / cellHeight) - this.slotsUptoCursor) * cellHeight;
21693
+ topValue = formatUnit(top < 0 ? 0 : top);
21673
21694
  const scrollHeight = this.parent.element.querySelector('.e-content-wrap').scrollHeight;
21674
21695
  const cloneBottom = parseInt(topValue, 10) + this.actionObj.clone.offsetHeight;
21675
21696
  if (cloneBottom > scrollHeight) {
@@ -22098,7 +22119,7 @@ class DragAndDrop extends ActionBase {
22098
22119
  (dragArea.scrollTop + dragArea.offsetHeight - this.actionObj.clone.offsetHeight + window.pageYOffset) +
22099
22120
  (this.actionObj.clone.offsetHeight - this.heightUptoCursorPoint);
22100
22121
  offsetTop = Math.round(offsetTop / this.actionObj.cellHeight) * this.actionObj.cellHeight;
22101
- if (dragArea.scrollTop > 0) {
22122
+ if (dragArea.scrollTop > 0 && offsetTop < dragArea.scrollHeight) {
22102
22123
  this.actionObj.clone.style.top = formatUnit(offsetTop);
22103
22124
  }
22104
22125
  }
@@ -22345,7 +22366,7 @@ class DragAndDrop extends ActionBase {
22345
22366
  let appHeight = this.parent.activeViewOptions.timeScale.enable ? this.verticalEvent.getHeight(eStart, eEnd) :
22346
22367
  this.actionObj.element.offsetHeight;
22347
22368
  let topValue = this.parent.activeViewOptions.timeScale.enable ?
22348
- this.verticalEvent.getTopValue(eStart, dayIndex, indexGroup) : this.actionObj.element.offsetTop;
22369
+ this.verticalEvent.getTopValue(eStart) : this.actionObj.element.offsetTop;
22349
22370
  if (isNullOrUndefined(index)) {
22350
22371
  if (i === 0) {
22351
22372
  this.actionObj.clone.style.top = formatUnit(topValue);
@@ -23133,6 +23154,10 @@ class ViewBase {
23133
23154
  }
23134
23155
  startHour.setMilliseconds(0);
23135
23156
  endHour.setMilliseconds(0);
23157
+ if (resetTime(date).getTime() !== resetTime(startHour).getTime()) {
23158
+ startHour = new Date(2000, 0, 0, startHour.getHours(), startHour.getMinutes(), startHour.getMilliseconds());
23159
+ endHour = new Date(2000, 0, 0, endHour.getHours(), endHour.getMinutes(), endHour.getMilliseconds());
23160
+ }
23136
23161
  return !(getDateInMs(date) < getDateInMs(startHour) || getDateInMs(date) >= getDateInMs(endHour) ||
23137
23162
  !this.isWorkDay(date, workDays));
23138
23163
  }
@@ -23849,7 +23874,7 @@ class VerticalView extends ViewBase {
23849
23874
  }
23850
23875
  }
23851
23876
  getTopFromDateTime(date) {
23852
- const startHour = this.getStartHour();
23877
+ const startHour = this.getStartEndHours(this.parent.activeViewOptions.startHour);
23853
23878
  const diffInMinutes = ((date.getHours() - startHour.getHours()) * 60) + (date.getMinutes() - startHour.getMinutes());
23854
23879
  return (diffInMinutes * this.getWorkCellHeight() * this.parent.activeViewOptions.timeScale.slotCount) /
23855
23880
  this.parent.activeViewOptions.timeScale.interval;