@syncfusion/ej2-schedule 21.2.3 → 21.2.5

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.
@@ -6547,6 +6547,7 @@ class VerticalEvent extends EventBase {
6547
6547
  removeClass(this.allDayElement, ALLDAY_ROW_ANIMATE_CLASS);
6548
6548
  this.slots.push(this.parent.activeView.renderDates.map((date) => +date));
6549
6549
  this.renderEvents('allDayEvents');
6550
+ this.animation.animate(this.allDayElement[0]);
6550
6551
  }
6551
6552
  this.parent.notify(contentReady, {});
6552
6553
  addClass(this.allDayElement, ALLDAY_ROW_ANIMATE_CLASS);
@@ -6647,6 +6648,8 @@ class VerticalEvent extends EventBase {
6647
6648
  const resources = this.getResourceList();
6648
6649
  let dateCount = this.getStartCount();
6649
6650
  let isRender;
6651
+ const appHeight = eventType === 'allDayEvents' ? getElementHeightFromClass(this.element.querySelector('.' + ALLDAY_APPOINTMENT_WRAPPER_CLASS), APPOINTMENT_CLASS) : 0;
6652
+ const allDayRowTop = eventType === 'allDayEvents' && this.allDayElement.length > 0 ? this.allDayElement[0].offsetTop : 0;
6650
6653
  for (const resource of resources) {
6651
6654
  isRender = true;
6652
6655
  if (this.parent.crudModule && this.parent.crudModule.crudObj.isCrudAction && eventType !== 'allDayEvents'
@@ -6672,7 +6675,7 @@ class VerticalEvent extends EventBase {
6672
6675
  this.setValues(event, resource);
6673
6676
  }
6674
6677
  if (eventType === 'allDayEvents') {
6675
- this.renderAllDayEvents(event, day, resource, dateCount);
6678
+ this.renderAllDayEvents(event, day, resource, dateCount, false, allDayRowTop, appHeight);
6676
6679
  }
6677
6680
  else {
6678
6681
  if (this.isAllDayAppointment(event)) {
@@ -6901,7 +6904,8 @@ class VerticalEvent extends EventBase {
6901
6904
  }
6902
6905
  return true;
6903
6906
  }
6904
- renderAllDayEvents(eventObj, dayIndex, resource, dayCount, inline) {
6907
+ // eslint-disable-next-line max-len
6908
+ renderAllDayEvents(eventObj, dayIndex, resource, dayCount, inline, cellTop, eventHeight) {
6905
6909
  let currentDates = this.getRenderedDates(this.dateRender[parseInt(resource.toString(), 10)]) ||
6906
6910
  this.dateRender[parseInt(resource.toString(), 10)];
6907
6911
  if (this.parent.activeViewOptions.group.byDate) {
@@ -6909,8 +6913,6 @@ class VerticalEvent extends EventBase {
6909
6913
  currentDates = [this.dateRender[parseInt(resource.toString(), 10)][parseInt(dayIndex.toString(), 10)]];
6910
6914
  }
6911
6915
  const record = this.splitEvent(eventObj, currentDates)[0];
6912
- const allDayRowCell = this.element.querySelector('.' + ALLDAY_CELLS_CLASS + ':first-child');
6913
- const cellTop = allDayRowCell.offsetTop;
6914
6916
  const eStart = new Date(record[this.parent.eventFields.startTime].getTime());
6915
6917
  const eEnd = new Date(record[this.parent.eventFields.endTime].getTime());
6916
6918
  let appWidth = 0;
@@ -6959,8 +6961,7 @@ class VerticalEvent extends EventBase {
6959
6961
  this.parent.trigger(eventRendered, args, (eventArgs) => {
6960
6962
  if (!eventArgs.cancel) {
6961
6963
  eventWrapper.appendChild(appointmentElement);
6962
- const appHeight = appointmentElement.offsetHeight;
6963
- topValue += (allDayIndex === 0 ? cellTop : (cellTop + (allDayIndex * appHeight))) + 1;
6964
+ topValue += (allDayIndex === 0 ? cellTop : (cellTop + (allDayIndex * eventHeight))) + 1;
6964
6965
  setStyleAttribute(appointmentElement, { 'width': appWidth + '%', 'top': formatUnit(topValue) });
6965
6966
  if (allDayIndex > 1) {
6966
6967
  this.moreEvents.push(appointmentElement);
@@ -6968,9 +6969,9 @@ class VerticalEvent extends EventBase {
6968
6969
  this.createMoreIndicator(allDayRow, count, wIndex);
6969
6970
  }
6970
6971
  }
6971
- allDayRowCell.setAttribute('data-count', this.allDayLevel.toString());
6972
+ this.allDayElement[0].setAttribute('data-count', this.allDayLevel.toString());
6972
6973
  const allDayRowHeight = ((!this.parent.uiStateValues.expand && this.allDayLevel > 2) ?
6973
- (3 * appHeight) : ((this.allDayLevel + 1) * appHeight)) + 4;
6974
+ (3 * eventHeight) : ((this.allDayLevel + 1) * eventHeight)) + 4;
6974
6975
  this.setAllDayRowHeight(allDayRowHeight);
6975
6976
  this.addOrRemoveClass();
6976
6977
  this.wireAppointmentEvents(appointmentElement, eventObj);
@@ -7190,13 +7191,11 @@ class VerticalEvent extends EventBase {
7190
7191
  this.parent.eventBase.allDayExpandScroll(dateHeader);
7191
7192
  }
7192
7193
  else {
7193
- dateHeader.scrollTop = 0;
7194
7194
  for (const element of this.allDayElement) {
7195
7195
  element.style.height = (height / 12) + 'em';
7196
7196
  }
7197
7197
  removeClass([dateHeader], ALLDAY_APPOINTMENT_SCROLL);
7198
7198
  }
7199
- this.animation.animate(this.allDayElement[0]);
7200
7199
  }
7201
7200
  addOrRemoveClass() {
7202
7201
  this.moreEvents.filter((element) => {
@@ -7255,8 +7254,10 @@ class VerticalEvent extends EventBase {
7255
7254
  target.setAttribute('title', this.parent.localeObj.getConstant('expandAllDaySection'));
7256
7255
  target.setAttribute('aria-label', 'Expand section');
7257
7256
  rowHeight = (3 * this.getEventHeight()) + 4;
7257
+ this.parent.element.querySelector('.' + DATE_HEADER_WRAP_CLASS).scrollTop = 0;
7258
7258
  }
7259
7259
  this.setAllDayRowHeight(rowHeight);
7260
+ this.animation.animate(this.allDayElement[0]);
7260
7261
  this.addOrRemoveClass();
7261
7262
  this.animation.animate(target);
7262
7263
  }
@@ -8130,10 +8131,21 @@ class TimelineEvent extends MonthEvent {
8130
8131
  'width': appWidth + 'px', 'left': appLeft + 'px', 'right': appRight + 'px', 'top': appTop + 'px'
8131
8132
  });
8132
8133
  this.wireAppointmentEvents(appointmentElement, event);
8133
- this.renderEventElement(event, appointmentElement, cellTd);
8134
8134
  if (this.parent.rowAutoHeight) {
8135
+ const conWrap = this.parent.element.querySelector('.' + CONTENT_WRAP_CLASS);
8136
+ const conWidth = conWrap.getBoundingClientRect().width;
8137
+ const isWithoutScroll = conWrap.offsetHeight === conWrap.clientHeight &&
8138
+ conWrap.offsetWidth === conWrap.clientWidth;
8139
+ this.renderEventElement(event, appointmentElement, cellTd);
8135
8140
  const firstChild = this.getFirstChild(resIndex);
8136
8141
  this.updateCellHeight(firstChild, height);
8142
+ if (isWithoutScroll &&
8143
+ (conWrap.offsetWidth > conWrap.clientWidth || conWidth !== conWrap.getBoundingClientRect().width)) {
8144
+ this.adjustAppointments(conWidth);
8145
+ }
8146
+ }
8147
+ else {
8148
+ this.renderEventElement(event, appointmentElement, cellTd);
8137
8149
  }
8138
8150
  }
8139
8151
  else {
@@ -8225,6 +8237,21 @@ class TimelineEvent extends MonthEvent {
8225
8237
  }
8226
8238
  }
8227
8239
  }
8240
+ adjustAppointments(conWidth) {
8241
+ const tr = this.parent.element.querySelector('.' + CONTENT_TABLE_CLASS + ' tbody tr');
8242
+ this.cellWidth = this.workCells[0].getBoundingClientRect().width;
8243
+ const currentPercentage = (this.cellWidth * tr.children.length) / (conWidth / 100);
8244
+ const apps = [].slice.call(this.parent.element.querySelectorAll('.' + APPOINTMENT_CLASS));
8245
+ apps.forEach((app) => {
8246
+ if (this.parent.enableRtl && app.style.right !== '0px') {
8247
+ app.style.right = ((parseFloat(app.style.right) / 100) * currentPercentage) + 'px';
8248
+ }
8249
+ else if (app.style.left !== '0px') {
8250
+ app.style.left = ((parseFloat(app.style.left) / 100) * currentPercentage) + 'px';
8251
+ }
8252
+ app.style.width = ((parseFloat(app.style.width) / 100) * currentPercentage) + 'px';
8253
+ });
8254
+ }
8228
8255
  getFirstChild(index) {
8229
8256
  const query = '.' + CONTENT_TABLE_CLASS + ' tbody td';
8230
8257
  let groupIndex = '';
@@ -8570,7 +8597,9 @@ class InlineEdit {
8570
8597
  allDayElements[0].offsetHeight) - 1;
8571
8598
  }
8572
8599
  verticalEvent.allDayLevel = allDayLevel;
8573
- verticalEvent.renderAllDayEvents(saveObj, index, resIndex, daysCount, this.parent.allowInline);
8600
+ const appHeight = getElementHeightFromClass(this.parent.element.querySelector('.' + ALLDAY_APPOINTMENT_WRAPPER_CLASS), APPOINTMENT_CLASS);
8601
+ const cellTop = verticalEvent.allDayElement.length > 0 ? verticalEvent.allDayElement[0].offsetTop : 0;
8602
+ verticalEvent.renderAllDayEvents(saveObj, index, resIndex, daysCount, this.parent.allowInline, cellTop, appHeight);
8574
8603
  }
8575
8604
  else {
8576
8605
  verticalEvent.renderNormalEvents(saveObj, index, resIndex, daysCount, this.parent.allowInline);
@@ -21460,9 +21489,12 @@ class DragAndDrop extends ActionBase {
21460
21489
  }
21461
21490
  else {
21462
21491
  if (this.isCursorAhead || cursorDrag) {
21463
- eventStart.setMinutes(eventStart.getMinutes() +
21464
- (this.isTimelineDayProcess ? MINUTES_PER_DAY : this.actionObj.slotInterval));
21492
+ const minutes = this.isTimelineDayProcess ? MINUTES_PER_DAY : this.actionObj.slotInterval;
21493
+ eventStart.setMinutes(eventStart.getMinutes() + minutes);
21465
21494
  eventStart.setMilliseconds(-(eventDuration));
21495
+ if (eventStart.getTime() === resetTime(eventStart).getTime() && eventStart.getMinutes() === 0 && eventDuration === 0) {
21496
+ eventStart.setMinutes(-minutes);
21497
+ }
21466
21498
  }
21467
21499
  else {
21468
21500
  eventStart.setMinutes(eventStart.getMinutes() -