@syncfusion/ej2-schedule 27.1.48 → 27.1.51

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 = '';
@@ -6354,7 +6357,7 @@ class EventBase {
6354
6357
  this.parent.activeEventData = { event: eventObject, element: target };
6355
6358
  }
6356
6359
  generateOccurrence(event, viewDate, isMaxCount) {
6357
- const startDate = event[this.parent.eventFields.startTime];
6360
+ let startDate = event[this.parent.eventFields.startTime];
6358
6361
  const endDate = event[this.parent.eventFields.endTime];
6359
6362
  const eventRule = event[this.parent.eventFields.recurrenceRule];
6360
6363
  const timeZoneDiff = endDate.getTimezoneOffset() - startDate.getTimezoneOffset();
@@ -6368,6 +6371,10 @@ class EventBase {
6368
6371
  const newTimezone = this.parent.timezone || this.parent.tzModule.getLocalTimezoneName();
6369
6372
  const firstDay = this.parent.activeViewOptions.firstDayOfWeek;
6370
6373
  const calendarMode = this.parent.calendarMode;
6374
+ if (event[this.parent.eventFields.recurrenceRule] && event[this.parent.eventFields.recurrenceRule].includes('BYMONTHDAY') &&
6375
+ this.parent.timezone && event[this.parent.eventFields.startTimezone] && event[this.parent.eventFields.endTimezone]) {
6376
+ startDate = this.parent.tzModule.convert(event[this.parent.eventFields.startTime], this.parent.timezone, event[this.parent.eventFields.startTimezone]);
6377
+ }
6371
6378
  const dates = generate(startDate, eventRule, exception, firstDay, maxCount, viewDate, calendarMode, newTimezone);
6372
6379
  if (this.parent.currentView === 'Agenda' && eventRule.indexOf('COUNT') === -1 && eventRule.indexOf('UNTIL') === -1) {
6373
6380
  if (isNullOrUndefined(event.generatedDates)) {
@@ -6382,10 +6389,18 @@ class EventBase {
6382
6389
  }
6383
6390
  }
6384
6391
  }
6392
+ let isDSTAdjusted = false;
6393
+ let convertedDates = [];
6394
+ if (event[this.parent.eventFields.recurrenceRule] && event[this.parent.eventFields.recurrenceRule].includes('BYMONTHDAY') &&
6395
+ this.parent.timezone && event[this.parent.eventFields.startTimezone] && event[this.parent.eventFields.endTimezone]) {
6396
+ isDSTAdjusted = true;
6397
+ convertedDates.push(...dates.map((date) => this.parent.tzModule.convert(new Date(date), event[this.parent.eventFields.startTimezone], this.parent.timezone).getTime()));
6398
+ }
6399
+ convertedDates = convertedDates.length > 0 ? convertedDates : dates;
6385
6400
  const occurrenceCollection = [];
6386
- for (let date of dates) {
6401
+ for (let date of convertedDates) {
6387
6402
  const clonedObject = extend({}, event, null, true);
6388
- date = this.getDSTAdjustedTime(date, clonedObject);
6403
+ date = !isDSTAdjusted ? this.getDSTAdjustedTime(date, clonedObject) : date;
6389
6404
  clonedObject[this.parent.eventFields.startTime] = new Date(date);
6390
6405
  clonedObject[this.parent.eventFields.endTime] = new Date(new Date(date).setMilliseconds(duration));
6391
6406
  clonedObject[this.parent.eventFields.recurrenceID] = clonedObject[this.parent.eventFields.id];
@@ -6825,8 +6840,8 @@ class VerticalEvent extends EventBase {
6825
6840
  this.slotCount = this.parent.activeViewOptions.timeScale.slotCount;
6826
6841
  this.interval = this.parent.activeViewOptions.timeScale.interval;
6827
6842
  this.allDayLevel = 0;
6828
- this.startHour = this.parent.activeView.getStartHour();
6829
- this.endHour = this.parent.activeView.getEndHour();
6843
+ this.startHour = this.getStartEndHours(this.parent.activeViewOptions.startHour);
6844
+ this.endHour = this.getStartEndHours(this.parent.activeViewOptions.endHour);
6830
6845
  this.element = this.parent.activeView.getPanel();
6831
6846
  this.fields = this.parent.eventFields;
6832
6847
  this.animation = new Animation({ progress: this.animationUiUpdate.bind(this) });
@@ -6954,7 +6969,7 @@ class VerticalEvent extends EventBase {
6954
6969
  const renderDates = this.dateRender[parseInt(resource.toString(), 10)];
6955
6970
  for (let day = 0, length = renderDates.length; day < length; day++) {
6956
6971
  const startDate = new Date(renderDates[parseInt(day.toString(), 10)].getTime());
6957
- const endDate = addDays(renderDates[parseInt(day.toString(), 10)], 1);
6972
+ const endDate = resetTime(addDays(renderDates[parseInt(day.toString(), 10)], 1));
6958
6973
  const filterEvents = this.filterEvents(startDate, endDate, this.parent.blockProcessed, this.resources[parseInt(resource.toString(), 10)]);
6959
6974
  for (const event of filterEvents) {
6960
6975
  if (this.parent.resourceBase) {
@@ -6984,7 +6999,7 @@ class VerticalEvent extends EventBase {
6984
6999
  }
6985
7000
  else {
6986
7001
  blockHeight = formatUnit(this.getHeight(eStart, eEnd));
6987
- blockTop = formatUnit(this.getTopValue(eStart, dayIndex, resource));
7002
+ blockTop = formatUnit(this.getTopValue(eStart));
6988
7003
  }
6989
7004
  const appointmentElement = this.createBlockAppointmentElement(eventObj, resource, this.isResourceEventTemplate);
6990
7005
  setStyleAttribute(appointmentElement, { 'width': '100%', 'height': blockHeight, 'top': blockTop });
@@ -7017,7 +7032,7 @@ class VerticalEvent extends EventBase {
7017
7032
  renderDates[parseInt(day.toString(), 10)] <= renderedDate[renderedDate.length - 1]; day++) {
7018
7033
  this.renderedEvents = [];
7019
7034
  const startDate = new Date(renderDates[parseInt(day.toString(), 10)].getTime());
7020
- const endDate = addDays(renderDates[parseInt(day.toString(), 10)], 1);
7035
+ const endDate = resetTime(addDays(renderDates[parseInt(day.toString(), 10)], 1));
7021
7036
  const filterEvents = this.filterEvents(startDate, endDate, eventCollection, this.resources[parseInt(resource.toString(), 10)]);
7022
7037
  if (isRender) {
7023
7038
  for (const event of filterEvents) {
@@ -7349,7 +7364,7 @@ class VerticalEvent extends EventBase {
7349
7364
  if (eStart <= eEnd && isValidEvent && this.isWorkDayAvailable(resource, eStart)) {
7350
7365
  const appHeight = record.isSpanned.isSameDuration ? this.cellHeight : this.getHeight(eStart, eEnd);
7351
7366
  if (eStart.getTime() >= schedule.startHour.getTime()) {
7352
- topValue = this.getTopValue(eStart, dayIndex, resource);
7367
+ topValue = this.getTopValue(eStart);
7353
7368
  }
7354
7369
  const appIndex = this.getOverlapIndex(record, dayIndex, false, resource);
7355
7370
  record.Index = appIndex;
@@ -7410,13 +7425,20 @@ class VerticalEvent extends EventBase {
7410
7425
  const tempLeft = (parseFloat(appWidth) + 1) * index;
7411
7426
  return (tempLeft > 99 ? 99 : tempLeft) + '%';
7412
7427
  }
7413
- getTopValue(date, day, resource) {
7414
- const viewDate = resetTime(this.dateRender[parseInt(resource.toString(), 10)][parseInt(day.toString(), 10)]);
7415
- const startEndHours = getStartEndHours(viewDate, this.startHour, this.endHour);
7416
- const startHour = startEndHours.startHour;
7417
- const adjustedStartHour = isDaylightSavingTime(viewDate) && (startHour.getHours() !== this.startHour.getHours()) ?
7418
- this.startHour.getHours() : startHour.getHours();
7419
- 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());
7420
7442
  return (this.parent.activeViewOptions.timeScale.enable) ? ((diffInMinutes * this.cellHeight * this.slotCount) / this.interval) : 0;
7421
7443
  }
7422
7444
  getOverlapIndex(record, day, isAllDay, resource) {
@@ -21550,13 +21572,16 @@ class DragAndDrop extends ActionBase {
21550
21572
  this.isCursorAhead = false;
21551
21573
  this.enableCurrentViewDrag = false;
21552
21574
  this.isPreventMultiDrag = false;
21575
+ this.slotsUptoCursor = -1;
21576
+ this.eleTop = 0;
21553
21577
  }
21554
21578
  wireDragEvent(element) {
21579
+ const isVerticalView = ['Day', 'Week', 'WorkWeek'].indexOf(this.parent.currentView) > -1;
21555
21580
  new Draggable(element, {
21556
21581
  abort: '.' + EVENT_RESIZE_CLASS,
21557
21582
  clone: true,
21558
21583
  isDragScroll: true,
21559
- enableTailMode: (this.parent.eventDragArea) ? true : false,
21584
+ enableTailMode: (this.parent.eventDragArea || isVerticalView) ? true : false,
21560
21585
  cursorAt: (this.parent.eventDragArea) ? { left: -20, top: -20 } : { left: 0, top: 0 },
21561
21586
  dragArea: this.dragArea,
21562
21587
  dragStart: this.dragStart.bind(this),
@@ -21579,6 +21604,8 @@ class DragAndDrop extends ActionBase {
21579
21604
  }
21580
21605
  this.setDragActionDefaultValues();
21581
21606
  this.actionObj.element = e.element;
21607
+ this.eleTop = parseFloat(this.actionObj.element.style.top);
21608
+ this.slotsUptoCursor = -1;
21582
21609
  this.actionObj.action = 'drag';
21583
21610
  let elements = [];
21584
21611
  if (!this.parent.allowMultiDrag || isNullOrUndefined(this.parent.selectedElements) || this.parent.selectedElements.length === 0 ||
@@ -21657,7 +21684,13 @@ class DragAndDrop extends ActionBase {
21657
21684
  }
21658
21685
  let top = parseInt(e.top, 10);
21659
21686
  top = top < 0 ? 0 : top;
21660
- 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);
21661
21694
  const scrollHeight = this.parent.element.querySelector('.e-content-wrap').scrollHeight;
21662
21695
  const cloneBottom = parseInt(topValue, 10) + this.actionObj.clone.offsetHeight;
21663
21696
  if (cloneBottom > scrollHeight) {
@@ -22086,7 +22119,7 @@ class DragAndDrop extends ActionBase {
22086
22119
  (dragArea.scrollTop + dragArea.offsetHeight - this.actionObj.clone.offsetHeight + window.pageYOffset) +
22087
22120
  (this.actionObj.clone.offsetHeight - this.heightUptoCursorPoint);
22088
22121
  offsetTop = Math.round(offsetTop / this.actionObj.cellHeight) * this.actionObj.cellHeight;
22089
- if (dragArea.scrollTop > 0) {
22122
+ if (dragArea.scrollTop > 0 && offsetTop < dragArea.scrollHeight) {
22090
22123
  this.actionObj.clone.style.top = formatUnit(offsetTop);
22091
22124
  }
22092
22125
  }
@@ -22333,7 +22366,7 @@ class DragAndDrop extends ActionBase {
22333
22366
  let appHeight = this.parent.activeViewOptions.timeScale.enable ? this.verticalEvent.getHeight(eStart, eEnd) :
22334
22367
  this.actionObj.element.offsetHeight;
22335
22368
  let topValue = this.parent.activeViewOptions.timeScale.enable ?
22336
- this.verticalEvent.getTopValue(eStart, dayIndex, indexGroup) : this.actionObj.element.offsetTop;
22369
+ this.verticalEvent.getTopValue(eStart) : this.actionObj.element.offsetTop;
22337
22370
  if (isNullOrUndefined(index)) {
22338
22371
  if (i === 0) {
22339
22372
  this.actionObj.clone.style.top = formatUnit(topValue);
@@ -23121,6 +23154,10 @@ class ViewBase {
23121
23154
  }
23122
23155
  startHour.setMilliseconds(0);
23123
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
+ }
23124
23161
  return !(getDateInMs(date) < getDateInMs(startHour) || getDateInMs(date) >= getDateInMs(endHour) ||
23125
23162
  !this.isWorkDay(date, workDays));
23126
23163
  }
@@ -23837,7 +23874,7 @@ class VerticalView extends ViewBase {
23837
23874
  }
23838
23875
  }
23839
23876
  getTopFromDateTime(date) {
23840
- const startHour = this.getStartHour();
23877
+ const startHour = this.getStartEndHours(this.parent.activeViewOptions.startHour);
23841
23878
  const diffInMinutes = ((date.getHours() - startHour.getHours()) * 60) + (date.getMinutes() - startHour.getMinutes());
23842
23879
  return (diffInMinutes * this.getWorkCellHeight() * this.parent.activeViewOptions.timeScale.slotCount) /
23843
23880
  this.parent.activeViewOptions.timeScale.interval;