@syncfusion/ej2-schedule 24.2.3 → 24.2.8

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.
Files changed (78) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/ej2-schedule.min.js +2 -2
  3. package/dist/ej2-schedule.umd.min.js +2 -2
  4. package/dist/ej2-schedule.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-schedule.es2015.js +128 -59
  6. package/dist/es6/ej2-schedule.es2015.js.map +1 -1
  7. package/dist/es6/ej2-schedule.es5.js +127 -58
  8. package/dist/es6/ej2-schedule.es5.js.map +1 -1
  9. package/dist/global/ej2-schedule.min.js +2 -2
  10. package/dist/global/ej2-schedule.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +14 -14
  13. package/src/schedule/actions/drag.js +14 -5
  14. package/src/schedule/actions/resize.js +41 -26
  15. package/src/schedule/actions/virtual-scroll.js +4 -0
  16. package/src/schedule/base/util.d.ts +21 -0
  17. package/src/schedule/base/util.js +29 -2
  18. package/src/schedule/event-renderer/inline-edit.js +1 -1
  19. package/src/schedule/event-renderer/month.js +3 -4
  20. package/src/schedule/event-renderer/timeline-view.d.ts +1 -0
  21. package/src/schedule/event-renderer/timeline-view.js +25 -7
  22. package/src/schedule/event-renderer/vertical-view.js +1 -1
  23. package/src/schedule/event-renderer/year.js +3 -3
  24. package/src/schedule/renderer/timeline-view.d.ts +0 -1
  25. package/src/schedule/renderer/timeline-view.js +3 -6
  26. package/src/schedule/renderer/vertical-view.js +1 -1
  27. package/src/schedule/renderer/view-base.js +1 -1
  28. package/styles/bootstrap-dark.css +42 -0
  29. package/styles/bootstrap.css +42 -0
  30. package/styles/bootstrap4.css +42 -0
  31. package/styles/bootstrap5-dark.css +42 -0
  32. package/styles/bootstrap5.css +42 -0
  33. package/styles/fabric-dark.css +42 -0
  34. package/styles/fabric.css +42 -0
  35. package/styles/fluent-dark.css +42 -0
  36. package/styles/fluent.css +42 -0
  37. package/styles/highcontrast-light.css +42 -0
  38. package/styles/highcontrast.css +42 -0
  39. package/styles/material-dark.css +42 -0
  40. package/styles/material.css +42 -0
  41. package/styles/material3-dark.css +42 -0
  42. package/styles/material3.css +42 -0
  43. package/styles/schedule/_bootstrap-dark-definition.scss +1 -0
  44. package/styles/schedule/_bootstrap-definition.scss +1 -0
  45. package/styles/schedule/_bootstrap4-definition.scss +1 -0
  46. package/styles/schedule/_bootstrap5-definition.scss +1 -0
  47. package/styles/schedule/_fabric-dark-definition.scss +1 -0
  48. package/styles/schedule/_fabric-definition.scss +1 -0
  49. package/styles/schedule/_fluent-definition.scss +1 -0
  50. package/styles/schedule/_fusionnew-definition.scss +1 -0
  51. package/styles/schedule/_highcontrast-definition.scss +1 -0
  52. package/styles/schedule/_highcontrast-light-definition.scss +1 -0
  53. package/styles/schedule/_layout.scss +58 -0
  54. package/styles/schedule/_material-dark-definition.scss +1 -0
  55. package/styles/schedule/_material-definition.scss +1 -0
  56. package/styles/schedule/_material3-definition.scss +1 -0
  57. package/styles/schedule/_tailwind-definition.scss +1 -0
  58. package/styles/schedule/bootstrap-dark.css +42 -0
  59. package/styles/schedule/bootstrap.css +42 -0
  60. package/styles/schedule/bootstrap4.css +42 -0
  61. package/styles/schedule/bootstrap5-dark.css +42 -0
  62. package/styles/schedule/bootstrap5.css +42 -0
  63. package/styles/schedule/fabric-dark.css +42 -0
  64. package/styles/schedule/fabric.css +42 -0
  65. package/styles/schedule/fluent-dark.css +42 -0
  66. package/styles/schedule/fluent.css +42 -0
  67. package/styles/schedule/highcontrast-light.css +42 -0
  68. package/styles/schedule/highcontrast.css +42 -0
  69. package/styles/schedule/material-dark.css +42 -0
  70. package/styles/schedule/material.css +42 -0
  71. package/styles/schedule/material3-dark.css +42 -0
  72. package/styles/schedule/material3.css +42 -0
  73. package/styles/schedule/tailwind-dark.css +42 -0
  74. package/styles/schedule/tailwind.css +42 -0
  75. package/styles/tailwind-dark.css +42 -0
  76. package/styles/tailwind.css +42 -0
  77. package/.github/PULL_REQUEST_TEMPLATE/Bug.md +0 -63
  78. package/.github/PULL_REQUEST_TEMPLATE/Feature.md +0 -39
@@ -115,7 +115,7 @@ function getElementHeightFromClass(container, elementClass) {
115
115
  el.style.visibility = 'hidden';
116
116
  el.style.position = 'absolute';
117
117
  container.appendChild(el);
118
- height = el.getBoundingClientRect().height;
118
+ height = getElementHeight(el);
119
119
  remove(el);
120
120
  return height;
121
121
  }
@@ -132,7 +132,7 @@ function getElementWidthFromClass(container, elementClass) {
132
132
  el.style.visibility = 'hidden';
133
133
  el.style.position = 'absolute';
134
134
  container.appendChild(el);
135
- width = el.getBoundingClientRect().width;
135
+ width = getElementWidth(el);
136
136
  remove(el);
137
137
  return width;
138
138
  }
@@ -519,6 +519,33 @@ function capitalizeFirstWord(inputString, type) {
519
519
  }
520
520
  return inputString;
521
521
  }
522
+ /**
523
+ * Method to get element cell width
524
+ *
525
+ * @param {HTMLElement} element Accepts the DOM element
526
+ * @returns {number} Returns the width of the given element
527
+ */
528
+ function getElementWidth(element) {
529
+ return document.body.style.transform.includes('scale') ? element.offsetWidth : element.getBoundingClientRect().width;
530
+ }
531
+ /**
532
+ * Method to get element cell Height
533
+ *
534
+ * @param {HTMLElement} element Accepts the DOM element
535
+ * @returns {number} Returns the Height of the given element
536
+ */
537
+ function getElementHeight(element) {
538
+ return document.body.style.transform.includes('scale') ? element.offsetHeight : element.getBoundingClientRect().height;
539
+ }
540
+ /**
541
+ * Method to get element cell Top
542
+ *
543
+ * @param {HTMLElement} element Accepts the DOM element
544
+ * @returns {number} Returns the top value of the given element
545
+ */
546
+ function getElementTop(element) {
547
+ return document.body.style.transform.includes('scale') ? element.offsetTop : element.getBoundingClientRect().top;
548
+ }
522
549
 
523
550
  /**
524
551
  * CSS Constants
@@ -6769,7 +6796,7 @@ class VerticalEvent extends EventBase {
6769
6796
  this.resources = this.parent.resourceBase.renderedResources;
6770
6797
  }
6771
6798
  this.cellHeight =
6772
- parseFloat(this.parent.element.querySelector('.e-content-wrap tbody tr').getBoundingClientRect().height.toFixed(2));
6799
+ parseFloat(getElementHeight(this.parent.element.querySelector('.e-content-wrap tbody tr')).toFixed(2));
6773
6800
  this.dateRender[0] = this.parent.activeView.renderDates;
6774
6801
  if (this.parent.activeViewOptions.group.resources.length > 0) {
6775
6802
  for (let i = 0, len = this.resources.length; i < len; i++) {
@@ -7641,10 +7668,9 @@ class MonthEvent extends EventBase {
7641
7668
  setStyleAttribute(cell, { 'height': height + 'px' });
7642
7669
  });
7643
7670
  }
7644
- const cellDetail = this.workCells[this.parent.activeView.isTimelineView() ?
7645
- 0 : this.workCells.length - 1].getBoundingClientRect();
7646
- this.cellWidth = cellDetail.width;
7647
- this.cellHeight = cellDetail.height;
7671
+ const cellDetail = this.workCells[this.parent.activeView.isTimelineView() ? 0 : this.workCells.length - 1];
7672
+ this.cellWidth = getElementWidth(cellDetail);
7673
+ this.cellHeight = getElementHeight(cellDetail);
7648
7674
  this.dateRender = dateRender;
7649
7675
  const filteredDates = this.getRenderedDates(dateRender);
7650
7676
  this.getSlotDates(workDays || this.parent.activeViewOptions.workDays);
@@ -8189,7 +8215,7 @@ class TimelineEvent extends MonthEvent {
8189
8215
  this.eventContainers = [].slice.call(this.element.querySelectorAll('.' + APPOINTMENT_CONTAINER_CLASS));
8190
8216
  const tr = [].slice.call(this.element.querySelectorAll('.' + CONTENT_TABLE_CLASS + ' tbody tr'));
8191
8217
  this.dayLength = tr.length === 0 ? 0 : tr[0].children.length;
8192
- this.content = this.parent.element.querySelector('.' + CONTENT_TABLE_CLASS);
8218
+ this.content = this.parent.element.querySelector('.' + SCHEDULE_TABLE_CLASS + '.' + CONTENT_TABLE_CLASS);
8193
8219
  }
8194
8220
  getSlotDates() {
8195
8221
  this.slots = [];
@@ -8198,7 +8224,7 @@ class TimelineEvent extends MonthEvent {
8198
8224
  this.parent.activeViewOptions.headerRows.slice(-1)[0].option !== 'Hour') {
8199
8225
  this.renderType = 'day';
8200
8226
  const workCell = this.content.querySelector('.' + WORK_CELLS_CLASS);
8201
- this.cellWidth = workCell.getBoundingClientRect().width / +(workCell.getAttribute('colspan') || 1);
8227
+ this.cellWidth = getElementWidth(workCell) / +(workCell.getAttribute('colspan') || 1);
8202
8228
  this.slotsPerDay = 1;
8203
8229
  }
8204
8230
  else {
@@ -8351,14 +8377,14 @@ class TimelineEvent extends MonthEvent {
8351
8377
  this.wireAppointmentEvents(appointmentElement, event);
8352
8378
  if (this.parent.rowAutoHeight) {
8353
8379
  const conWrap = this.parent.element.querySelector('.' + CONTENT_WRAP_CLASS);
8354
- const conWidth = conWrap.getBoundingClientRect().width;
8380
+ const conWidth = getElementWidth(conWrap);
8355
8381
  const isWithoutScroll = conWrap.offsetHeight === conWrap.clientHeight &&
8356
8382
  conWrap.offsetWidth === conWrap.clientWidth;
8357
8383
  this.renderEventElement(event, appointmentElement, cellTd);
8358
8384
  const firstChild = this.getFirstChild(resIndex);
8359
8385
  this.updateCellHeight(firstChild, height);
8360
8386
  if (isWithoutScroll &&
8361
- (conWrap.offsetWidth > conWrap.clientWidth || conWidth !== conWrap.getBoundingClientRect().width)) {
8387
+ (conWrap.offsetWidth > conWrap.clientWidth || conWidth !== getElementWidth(conWrap))) {
8362
8388
  this.adjustAppointments(conWidth);
8363
8389
  }
8364
8390
  }
@@ -8384,8 +8410,11 @@ class TimelineEvent extends MonthEvent {
8384
8410
  this.slotCount / this.interval;
8385
8411
  for (let k = 0; k < slotCount; k++) {
8386
8412
  startDate = (k === 0) ? new Date(startDate.getTime()) : new Date(startDate.getTime() + (60000 * interval));
8413
+ if (slotCount < 1) {
8414
+ startDate = this.adjustToNearestTimeSlot(startDate, interval);
8415
+ }
8387
8416
  endDate = new Date(startDate.getTime() + (60000 * interval));
8388
- if (endDate.getTime() > endTime.getTime()) {
8417
+ if (slotCount >= 1 && endDate.getTime() > endTime.getTime()) {
8389
8418
  break;
8390
8419
  }
8391
8420
  const position = this.getPosition(startDate, endDate, false, (this.day + i));
@@ -8401,6 +8430,20 @@ class TimelineEvent extends MonthEvent {
8401
8430
  }
8402
8431
  this.parent.renderTemplates();
8403
8432
  }
8433
+ adjustToNearestTimeSlot(inputTime, interval) {
8434
+ // Parse the input time
8435
+ const parsedTime = new Date(inputTime);
8436
+ // Get the minutes of the input time in milliseconds
8437
+ const minutesInMilliseconds = parsedTime.getHours() * 60 * 60 * 1000 + parsedTime.getMinutes() * 60 * 1000;
8438
+ // Calculate the adjusted time in milliseconds (nearest time slot)
8439
+ const adjustedMinutesInMilliseconds = Math.floor(minutesInMilliseconds / (interval * 60 * 1000)) * (interval * 60 * 1000);
8440
+ // Create a new Date object with the adjusted time
8441
+ const adjustedTime = new Date(parsedTime.getTime());
8442
+ adjustedTime.setHours(adjustedMinutesInMilliseconds / (60 * 60 * 1000) % 24);
8443
+ adjustedTime.setMinutes((adjustedMinutesInMilliseconds % (60 * 60 * 1000)) / (60 * 1000));
8444
+ // Return the adjusted time in string format
8445
+ return adjustedTime;
8446
+ }
8404
8447
  renderTimelineMoreIndicator(startTime, startDate, endDate, appHeight, interval, resIndex, appointmentsList, top, appLeft, appRight, cellTd, moreIndicator, appPos, position) {
8405
8448
  appLeft = (this.parent.enableRtl) ? appRight = position : position;
8406
8449
  appPos = (this.parent.enableRtl) ? appRight : appLeft;
@@ -8459,8 +8502,9 @@ class TimelineEvent extends MonthEvent {
8459
8502
  }
8460
8503
  adjustAppointments(conWidth) {
8461
8504
  const tr = this.parent.element.querySelector('.' + CONTENT_TABLE_CLASS + ' tbody tr');
8462
- this.cellWidth = this.workCells[0].getBoundingClientRect().width;
8463
- const currentPercentage = (this.cellWidth * tr.children.length) / (conWidth / 100);
8505
+ const actualCellWidth = getElementWidth(this.workCells[0]);
8506
+ this.cellWidth = actualCellWidth / +(this.workCells[0].getAttribute('colspan') || 1);
8507
+ const currentPercentage = (actualCellWidth * tr.children.length) / (conWidth / 100);
8464
8508
  const apps = [].slice.call(this.parent.element.querySelectorAll('.' + APPOINTMENT_CLASS));
8465
8509
  apps.forEach((app) => {
8466
8510
  if (this.parent.enableRtl && app.style.right !== '0px') {
@@ -8813,7 +8857,7 @@ class InlineEdit {
8813
8857
  const allDayElements = [].slice.call(this.parent.element.querySelectorAll('.' + ALLDAY_APPOINTMENT_CLASS));
8814
8858
  let allDayLevel = 0;
8815
8859
  if (allDayElements.length > 0) {
8816
- allDayLevel = Math.floor(this.parent.element.querySelector('.' + ALLDAY_ROW_CLASS).getBoundingClientRect().height /
8860
+ allDayLevel = Math.floor(getElementHeight(this.parent.element.querySelector('.' + ALLDAY_ROW_CLASS)) /
8817
8861
  allDayElements[0].offsetHeight) - 1;
8818
8862
  }
8819
8863
  verticalEvent.allDayLevel = allDayLevel;
@@ -13691,6 +13735,10 @@ class VirtualScroll {
13691
13735
  this.renderedLength = conTable.querySelector('tbody').children.length;
13692
13736
  virtual.style.height = (conTable.offsetHeight + (this.parent.resourceBase.expandedResources.length - (this.renderedLength)) *
13693
13737
  conTable.offsetHeight / this.renderedLength) + 'px';
13738
+ const conWrap = this.parent.element.querySelector('.' + CONTENT_WRAP_CLASS);
13739
+ if ((conWrap.scrollHeight - conWrap.scrollTop) < conWrap.offsetHeight * this.bufferCount) {
13740
+ virtual.style.height = parseInt(virtual.style.height) + (conWrap.offsetHeight * this.bufferCount) + 'px';
13741
+ }
13694
13742
  }
13695
13743
  else {
13696
13744
  virtual.style.height = '';
@@ -19927,9 +19975,9 @@ class Resize extends ActionBase {
19927
19975
  bottom: resizeTarget.classList.contains(BOTTOM_RESIZE_HANDLER)
19928
19976
  };
19929
19977
  this.actionObj.groupIndex = this.parent.uiStateValues.isGroupAdaptive ? this.parent.uiStateValues.groupIndex : 0;
19930
- const workCell = this.parent.element.querySelector('.' + WORK_CELLS_CLASS).getBoundingClientRect();
19931
- this.actionObj.cellWidth = workCell.width;
19932
- this.actionObj.cellHeight = workCell.height;
19978
+ const workCell = this.parent.element.querySelector('.' + WORK_CELLS_CLASS);
19979
+ this.actionObj.cellWidth = getElementWidth(workCell);
19980
+ this.actionObj.cellHeight = getElementHeight(workCell);
19933
19981
  const hRows = this.parent.activeViewOptions.headerRows.map((row) => row.option);
19934
19982
  if (this.parent.activeView.isTimelineView() && hRows.length > 0 && ['Date', 'Hour'].indexOf(hRows.slice(-1)[0]) < 0) {
19935
19983
  const tr = this.parent.getContentTable().querySelector('tr');
@@ -20223,9 +20271,9 @@ class Resize extends ActionBase {
20223
20271
  parseInt(this.actionObj.clone.style.left, 10);
20224
20272
  offsetValue = Math.round(offsetValue / this.actionObj.cellWidth) * this.actionObj.cellWidth;
20225
20273
  if (!isLeft) {
20226
- offsetValue += (this.actionObj.clone.getBoundingClientRect().width - this.actionObj.cellWidth);
20274
+ offsetValue += (getElementWidth(this.actionObj.clone) - this.actionObj.cellWidth);
20227
20275
  }
20228
- cellIndex = Math.floor(offsetValue / Math.floor(tr.getBoundingClientRect().width / noOfDays));
20276
+ cellIndex = Math.floor(offsetValue / Math.floor(getElementWidth(tr) / noOfDays));
20229
20277
  isDateHeader = isTimeViews && headerName === 'Date';
20230
20278
  cellIndex = isLeft ? cellIndex : isTimelineMonth ? cellIndex + 1 : cellIndex;
20231
20279
  isLastCell = cellIndex === tdCollections.length;
@@ -20234,7 +20282,7 @@ class Resize extends ActionBase {
20234
20282
  else {
20235
20283
  const cellWidth = this.actionObj.cellWidth;
20236
20284
  cellIndex = isLeft ? Math.floor(offset / this.actionObj.cellWidth) :
20237
- Math.ceil((offset + (this.actionObj.clone.getBoundingClientRect().width - cellWidth)) / this.actionObj.cellWidth);
20285
+ Math.ceil((offset + (getElementWidth(this.actionObj.clone) - cellWidth)) / this.actionObj.cellWidth);
20238
20286
  if (this.parent.enableRtl) {
20239
20287
  let cellOffsetWidth = 0;
20240
20288
  if (headerName === 'TimelineMonth' || (!this.parent.activeViewOptions.timeScale.enable &&
@@ -20242,7 +20290,7 @@ class Resize extends ActionBase {
20242
20290
  cellOffsetWidth = this.actionObj.cellWidth;
20243
20291
  }
20244
20292
  const offsetWidth = (Math.floor(offset / this.actionObj.cellWidth) *
20245
- this.actionObj.cellWidth) + (isLeft ? 0 : this.actionObj.clone.getBoundingClientRect().width - cellOffsetWidth);
20293
+ this.actionObj.cellWidth) + (isLeft ? 0 : getElementWidth(this.actionObj.clone) - cellOffsetWidth);
20246
20294
  cellIndex = Math.floor(offsetWidth / this.actionObj.cellWidth);
20247
20295
  }
20248
20296
  isLastCell = cellIndex === tdCollections.length;
@@ -20261,7 +20309,7 @@ class Resize extends ActionBase {
20261
20309
  }
20262
20310
  else {
20263
20311
  if (!isLeft) {
20264
- offset += this.actionObj.clone.getBoundingClientRect().width;
20312
+ offset += getElementWidth(this.actionObj.clone);
20265
20313
  }
20266
20314
  let spanMinutes = Math.ceil((this.actionObj.slotInterval / this.actionObj.cellWidth) *
20267
20315
  (offset - Math.floor(offset / this.actionObj.cellWidth) * this.actionObj.cellWidth));
@@ -20273,9 +20321,9 @@ class Resize extends ActionBase {
20273
20321
  }
20274
20322
  else {
20275
20323
  const cloneIndex = closest(this.actionObj.clone, 'td').cellIndex;
20276
- const originalWidth = Math.ceil((isLeft ? this.actionObj.element.getBoundingClientRect().width : 0) /
20324
+ const originalWidth = Math.ceil((isLeft ? getElementWidth(this.actionObj.element) : 0) /
20277
20325
  this.actionObj.cellWidth) * this.actionObj.cellWidth;
20278
- const noOfDays = Math.ceil((this.actionObj.clone.getBoundingClientRect().width - originalWidth) /
20326
+ const noOfDays = Math.ceil((getElementWidth(this.actionObj.clone) - originalWidth) /
20279
20327
  this.actionObj.cellWidth);
20280
20328
  const tr = closest(this.actionObj.clone, 'tr');
20281
20329
  let dayIndex = isLeft ? cloneIndex - noOfDays : cloneIndex + noOfDays - 1;
@@ -20338,30 +20386,38 @@ class Resize extends ActionBase {
20338
20386
  const slotInterval = (this.actionObj.cellWidth / this.actionObj.slotInterval) * this.actionObj.interval;
20339
20387
  const pageWidth = isLeft ? (this.actionObj.X - this.actionObj.pageX) : (this.actionObj.pageX - this.actionObj.X);
20340
20388
  const targetWidth = isTimelineView ?
20341
- (this.actionObj.element.getBoundingClientRect().width / this.actionObj.cellWidth) * this.actionObj.cellWidth :
20342
- this.parent.currentView === 'Month' ? this.actionObj.element.getBoundingClientRect().width :
20343
- Math.ceil(this.actionObj.element.getBoundingClientRect().width / this.actionObj.cellWidth) * this.actionObj.cellWidth;
20389
+ (getElementWidth(this.actionObj.element) / this.actionObj.cellWidth) * this.actionObj.cellWidth :
20390
+ this.parent.currentView === 'Month' ? getElementWidth(this.actionObj.element) :
20391
+ Math.ceil(getElementWidth(this.actionObj.element) / this.actionObj.cellWidth) * this.actionObj.cellWidth;
20344
20392
  let offsetWidth = targetWidth + (Math.ceil(pageWidth / this.actionObj.cellWidth) * this.actionObj.cellWidth);
20345
20393
  const left = (this.parent.enableRtl) ? parseInt(this.actionObj.element.style.right, 10) : this.actionObj.clone.offsetLeft;
20346
20394
  if (isTimeViews) {
20347
20395
  offsetWidth = targetWidth + (Math.ceil(pageWidth / slotInterval) * slotInterval);
20348
- offsetWidth = (Math.round((left + offsetWidth) / slotInterval) * slotInterval) - left;
20396
+ if (!isLeft) {
20397
+ const roundedLeft = (+parseFloat(this.actionObj.element.style[this.parent.enableRtl ? 'right' : 'left'])).toFixed(1);
20398
+ const roundedWidth = Math.round(targetWidth / slotInterval) * slotInterval;
20399
+ if (roundedLeft !== left.toFixed(1) || roundedWidth !== targetWidth) {
20400
+ offsetWidth = (Math.round((left + offsetWidth) / slotInterval) * slotInterval) - left;
20401
+ }
20402
+ }
20349
20403
  this.actionObj.event[this.parent.eventFields.isAllDay] = false;
20350
20404
  }
20351
20405
  let width = !isLeft && ((offsetWidth + this.actionObj.clone.offsetLeft > this.scrollArgs.width)) ?
20352
- this.actionObj.clone.getBoundingClientRect().width : (offsetWidth < this.actionObj.cellWidth) ? offsetWidth : offsetWidth;
20406
+ getElementWidth(this.actionObj.clone) : (offsetWidth < this.actionObj.cellWidth) ? offsetWidth : offsetWidth;
20353
20407
  if (this.parent.enableRtl) {
20354
20408
  let rightValue = isTimelineView ? parseInt(this.actionObj.element.style.right, 10) :
20355
20409
  -(offsetWidth - this.actionObj.cellWidth);
20356
20410
  rightValue = isTimelineView ? rightValue : isLeft ? 0 : rightValue > 0 ? 0 : rightValue;
20357
20411
  if (isTimelineView && !isLeft) {
20358
- rightValue = Math.ceil((this.actionObj.element.offsetLeft + (this.actionObj.element.getBoundingClientRect().width +
20359
- (this.actionObj.pageX - this.actionObj.X))) / slotInterval) * slotInterval;
20360
- rightValue = rightValue < 0 ? Math.abs(rightValue) : -rightValue;
20412
+ rightValue = rightValue - (Math.ceil((this.actionObj.pageX - this.actionObj.X) / slotInterval) * slotInterval);
20413
+ if (rightValue < 0) {
20414
+ rightValue = parseInt(this.actionObj.clone.style.right, 10);
20415
+ width = parseInt(this.actionObj.clone.style.width, 10);
20416
+ }
20361
20417
  }
20362
20418
  rightValue = rightValue >= this.scrollArgs.width ? this.scrollArgs.width - this.actionObj.cellWidth : rightValue;
20363
20419
  styles.right = formatUnit(rightValue);
20364
- width = width + rightValue > this.scrollArgs.width ? this.actionObj.clone.getBoundingClientRect().width : width;
20420
+ width = width + rightValue > this.scrollArgs.width ? getElementWidth(this.actionObj.clone) : width;
20365
20421
  }
20366
20422
  else {
20367
20423
  let offsetLeft = isLeft ? this.actionObj.element.offsetLeft - (this.actionObj.X - this.actionObj.pageX) :
@@ -20369,24 +20425,31 @@ class Resize extends ActionBase {
20369
20425
  if (isTimelineView) {
20370
20426
  offsetLeft = isLeft ? offsetLeft : parseInt(this.actionObj.clone.style.left, 10);
20371
20427
  if (this.parent.enableRtl) {
20372
- offsetLeft = !isLeft ? (this.actionObj.pageX < this.actionObj.X - this.actionObj.clone.getBoundingClientRect().width)
20428
+ offsetLeft = !isLeft ? (this.actionObj.pageX < this.actionObj.X - getElementWidth(this.actionObj.clone))
20373
20429
  ? parseInt(this.actionObj.clone.style.right, 10) : offsetLeft : offsetLeft;
20374
20430
  }
20375
20431
  else {
20376
- offsetLeft = isLeft ? (this.actionObj.pageX > this.actionObj.X + this.actionObj.clone.getBoundingClientRect().width &&
20377
- this.actionObj.clone.getBoundingClientRect().width === this.actionObj.cellWidth) ?
20432
+ offsetLeft = isLeft ? (this.actionObj.pageX > this.actionObj.X + getElementWidth(this.actionObj.clone) &&
20433
+ getElementWidth(this.actionObj.clone) === this.actionObj.cellWidth) ?
20378
20434
  parseInt(this.actionObj.clone.style.left, 10) : offsetLeft : offsetLeft;
20379
20435
  }
20380
20436
  }
20381
20437
  const leftValue = offsetLeft;
20382
- offsetLeft = isTimelineView ? isTimeViews ? isLeft ? Math.floor(offsetLeft / slotInterval) * slotInterval : offsetLeft :
20438
+ offsetLeft = isTimelineView ? isTimeViews ? isLeft ? this.actionObj.element.offsetLeft -
20439
+ (Math.ceil((this.actionObj.element.offsetLeft - offsetLeft) / slotInterval) * slotInterval) : offsetLeft :
20383
20440
  Math.floor(offsetLeft / this.actionObj.cellWidth) * this.actionObj.cellWidth :
20384
20441
  Math.ceil(Math.abs(offsetLeft) / this.actionObj.cellWidth) * this.actionObj.cellWidth;
20385
20442
  if (offsetLeft < 0) {
20386
- offsetLeft = 0;
20387
- width = this.actionObj.clone.getBoundingClientRect().width;
20443
+ if (isTimelineView && isLeft && (offsetLeft % slotInterval)) {
20444
+ offsetLeft = parseInt(this.actionObj.clone.style.left, 10);
20445
+ width = parseInt(this.actionObj.clone.style.width, 10);
20446
+ }
20447
+ else {
20448
+ offsetLeft = 0;
20449
+ width = getElementWidth(this.actionObj.clone);
20450
+ }
20388
20451
  }
20389
- const cloneWidth = Math.ceil(this.actionObj.clone.getBoundingClientRect().width / this.actionObj.cellWidth) *
20452
+ const cloneWidth = Math.ceil(getElementWidth(this.actionObj.clone) / this.actionObj.cellWidth) *
20390
20453
  this.actionObj.cellWidth;
20391
20454
  if (isLeft) {
20392
20455
  styles.left = formatUnit(isTimelineView ? offsetLeft : isLeft ? leftValue < 0 ? -offsetLeft :
@@ -20499,7 +20562,7 @@ class YearEvent extends TimelineEvent {
20499
20562
  }
20500
20563
  timelineYearViewEvents() {
20501
20564
  const workCell = this.parent.element.querySelector('.' + WORK_CELLS_CLASS + ':not(.' + OTHERMONTH_CLASS + ')');
20502
- this.cellWidth = workCell.getBoundingClientRect().width;
20565
+ this.cellWidth = getElementWidth(workCell);
20503
20566
  this.cellHeader = getOuterHeight(workCell.querySelector('.' + DATE_HEADER_CLASS));
20504
20567
  const eventTable = this.parent.element.querySelector('.' + EVENT_TABLE_CLASS);
20505
20568
  this.eventHeight = getElementHeightFromClass(eventTable, APPOINTMENT_CLASS);
@@ -20648,7 +20711,7 @@ class YearEvent extends TimelineEvent {
20648
20711
  const contentTable = this.parent.element.querySelector('.' + CONTENT_WRAP_CLASS);
20649
20712
  const isVerticalScrollbarAvail = contentTable.offsetWidth > contentTable.clientWidth;
20650
20713
  const workCell = this.parent.element.querySelector('.' + WORK_CELLS_CLASS);
20651
- this.cellWidth = workCell.getBoundingClientRect().width;
20714
+ this.cellWidth = getElementWidth(workCell);
20652
20715
  this.cellHeader = 0;
20653
20716
  const eventTable = this.parent.element.querySelector('.' + EVENT_TABLE_CLASS);
20654
20717
  this.eventHeight = getElementHeightFromClass(eventTable, APPOINTMENT_CLASS);
@@ -20693,7 +20756,7 @@ class YearEvent extends TimelineEvent {
20693
20756
  appWrapper.forEach((appWrap, cellIndex) => {
20694
20757
  const td = row.querySelector(`td:nth-child(${cellIndex + 1})`);
20695
20758
  const app = [].slice.call(appWrap.children);
20696
- const width = td.getBoundingClientRect().width;
20759
+ const width = getElementWidth(td);
20697
20760
  const left = td.offsetLeft;
20698
20761
  if (this.parent.enableRtl) {
20699
20762
  const right = conTable.offsetWidth - left - td.offsetWidth;
@@ -21417,7 +21480,7 @@ class DragAndDrop extends ActionBase {
21417
21480
  this.timelineEventModule.cellWidth = this.actionObj.cellWidth;
21418
21481
  this.timelineEventModule.getSlotDates();
21419
21482
  this.actionObj.cellWidth = this.isHeaderRows ? this.timelineEventModule.cellWidth :
21420
- this.parent.element.querySelector('.' + WORK_CELLS_CLASS).getBoundingClientRect().width;
21483
+ getElementWidth(this.parent.element.querySelector('.' + WORK_CELLS_CLASS));
21421
21484
  this.calculateTimelineTime(e);
21422
21485
  }
21423
21486
  else {
@@ -22031,13 +22094,20 @@ class DragAndDrop extends ActionBase {
22031
22094
  if (this.isStepDragging) {
22032
22095
  const widthDiff = this.getWidthDiff(tr, index);
22033
22096
  if (widthDiff !== 0) {
22034
- const timeDiff = Math.round(widthDiff / this.widthPerMinute);
22097
+ let timeDiff = Math.ceil(widthDiff / this.widthPerMinute);
22035
22098
  eventStart.setMinutes(eventStart.getMinutes() + (timeDiff * this.actionObj.interval));
22036
22099
  if (this.isCursorAhead || cursorDrag) {
22037
22100
  eventStart.setMilliseconds(-(eventDuration));
22038
22101
  }
22039
22102
  else {
22040
22103
  eventStart.setMinutes(eventStart.getMinutes() - this.minDiff);
22104
+ const intervalInMS = this.actionObj.interval * MS_PER_MINUTE;
22105
+ timeDiff = Math.abs(eventStart.getTime() - this.actionObj.start.getTime()) / intervalInMS;
22106
+ const roundTimeDiff = Math.trunc(timeDiff);
22107
+ if (roundTimeDiff !== timeDiff) {
22108
+ timeDiff = (roundTimeDiff * intervalInMS) * (eventStart > this.actionObj.start ? 1 : -1);
22109
+ eventStart = new Date(this.actionObj.start.getTime() + timeDiff);
22110
+ }
22041
22111
  }
22042
22112
  }
22043
22113
  else {
@@ -22058,7 +22128,9 @@ class DragAndDrop extends ActionBase {
22058
22128
  (this.cursorPointIndex * (this.isTimelineDayProcess ? MINUTES_PER_DAY : this.actionObj.slotInterval)));
22059
22129
  }
22060
22130
  }
22061
- eventStart = this.calculateIntervalTime(eventStart);
22131
+ if (!this.isStepDragging) {
22132
+ eventStart = this.calculateIntervalTime(eventStart);
22133
+ }
22062
22134
  if (this.isTimelineDayProcess) {
22063
22135
  const eventSrt = eventObj[this.parent.eventFields.startTime];
22064
22136
  eventStart.setHours(eventSrt.getHours(), eventSrt.getMinutes(), eventSrt.getSeconds());
@@ -22220,7 +22292,7 @@ class DragAndDrop extends ActionBase {
22220
22292
  ~~(dragArea.querySelector('table').offsetHeight / trCollection.length) : this.actionObj.cellHeight;
22221
22293
  let rowIndex = Math.floor(Math.floor((this.actionObj.Y +
22222
22294
  (dragArea.scrollTop - translateY - (window.scrollY || window.pageYOffset))) -
22223
- dragArea.getBoundingClientRect().top) / rowHeight);
22295
+ getElementTop(dragArea)) / rowHeight);
22224
22296
  rowIndex = (rowIndex < 0) ? 0 : (rowIndex > trCollection.length - 1) ? trCollection.length - 1 : rowIndex;
22225
22297
  this.actionObj.index = rowIndex;
22226
22298
  const eventContainer = this.parent.element.querySelectorAll('.e-appointment-container:not(.e-hidden)').item(rowIndex);
@@ -22236,7 +22308,7 @@ class DragAndDrop extends ActionBase {
22236
22308
  if (!isNullOrUndefined(this.parent.eventDragArea)) {
22237
22309
  return;
22238
22310
  }
22239
- let top = trCollection[parseInt(rowIndex.toString(), 10)].getBoundingClientRect().height * rowIndex;
22311
+ let top = getElementHeight(trCollection[parseInt(rowIndex.toString(), 10)]) * rowIndex;
22240
22312
  if (this.parent.rowAutoHeight) {
22241
22313
  const cursorElement = this.getCursorElement(e);
22242
22314
  if (cursorElement) {
@@ -22749,7 +22821,7 @@ class ViewBase {
22749
22821
  if (this.isTimelineView()) {
22750
22822
  const colElements = this.getColElements();
22751
22823
  const contentBody = this.element.querySelector('.' + CONTENT_TABLE_CLASS + ' tbody');
22752
- const colWidth = (contentBody.getBoundingClientRect().width / (colElements.length / 2));
22824
+ const colWidth = (getElementWidth(contentBody) / (colElements.length / 2));
22753
22825
  if (content.offsetHeight !== content.clientHeight) {
22754
22826
  const resourceColumn = this.parent.element.querySelector('.' + RESOURCE_COLUMN_WRAP_CLASS);
22755
22827
  if (!isNullOrUndefined(resourceColumn)) {
@@ -23230,7 +23302,7 @@ class VerticalView extends ViewBase {
23230
23302
  this.parent.activeViewOptions.timeScale.interval;
23231
23303
  }
23232
23304
  getWorkCellHeight() {
23233
- return parseFloat(this.element.querySelector('.' + WORK_CELLS_CLASS).getBoundingClientRect().height.toFixed(2));
23305
+ return parseFloat(getElementHeight(this.element.querySelector('.' + WORK_CELLS_CLASS)).toFixed(2));
23234
23306
  }
23235
23307
  getTdContent(date, type, groupIndex) {
23236
23308
  let cntEle;
@@ -23617,7 +23689,7 @@ class VerticalView extends ViewBase {
23617
23689
  const msStartHour = startHour.getTime();
23618
23690
  const msEndHour = endHour.getTime();
23619
23691
  if (msStartHour !== msEndHour) {
23620
- let milliSeconds = (startHour.getTimezoneOffset() !== endHour.getTimezoneOffset()) ?
23692
+ const milliSeconds = (startHour.getTimezoneOffset() !== endHour.getTimezoneOffset()) ?
23621
23693
  (msEndHour - msStartHour) - 3600000 : (msEndHour - msStartHour);
23622
23694
  length = Math.round(milliSeconds / msInterval);
23623
23695
  }
@@ -26016,7 +26088,7 @@ class TimelineViews extends VerticalView {
26016
26088
  }
26017
26089
  let scrollLeft;
26018
26090
  if (isNullOrUndefined(hour) || !this.parent.activeViewOptions.timeScale.enable) {
26019
- scrollLeft = index * this.getWorkCellWidth();
26091
+ scrollLeft = index * getElementWidth(this.element.querySelector('.e-work-cells'));
26020
26092
  }
26021
26093
  else {
26022
26094
  scrollLeft = isNullOrUndefined(scrollDate) ? this.getLeftFromDateTime(null, date) :
@@ -26100,7 +26172,7 @@ class TimelineViews extends VerticalView {
26100
26172
  if (this.parent.activeView.colLevels[parseInt(index.toString(), 10)] &&
26101
26173
  this.parent.activeView.colLevels[parseInt(index.toString(), 10)][0].colSpan) {
26102
26174
  diffInDates = currentDateIndex[0] * this.parent.activeView.colLevels[parseInt(index.toString(), 10)][0].colSpan *
26103
- this.getWorkCellWidth();
26175
+ getElementWidth(this.element.querySelector('.e-work-cells'));
26104
26176
  }
26105
26177
  else {
26106
26178
  const endHour = this.getEndHour();
@@ -26110,12 +26182,9 @@ class TimelineViews extends VerticalView {
26110
26182
  }
26111
26183
  }
26112
26184
  }
26113
- return diffInDates + ((diffInMinutes * this.getWorkCellWidth() * this.parent.activeViewOptions.timeScale.slotCount) /
26185
+ return diffInDates + ((diffInMinutes * getElementWidth(this.element.querySelector('.e-work-cells')) * this.parent.activeViewOptions.timeScale.slotCount) /
26114
26186
  this.parent.activeViewOptions.timeScale.interval);
26115
26187
  }
26116
- getWorkCellWidth() {
26117
- return this.element.querySelector('.e-work-cells').getBoundingClientRect().width;
26118
- }
26119
26188
  renderHeader() {
26120
26189
  const tr = createElement('tr');
26121
26190
  if (this.parent.activeViewOptions.group.resources.length > 0 && !this.parent.uiStateValues.isGroupAdaptive) {
@@ -27490,5 +27559,5 @@ class Print {
27490
27559
  * Export Schedule components
27491
27560
  */
27492
27561
 
27493
- export { Schedule, cellClick, cellDoubleClick, moreEventsClick, select, hover, actionBegin, actionComplete, actionFailure, navigating, renderCell, eventClick, eventDoubleClick, eventRendered, dataBinding, dataBound, popupOpen, popupClose, dragStart, drag, dragStop, resizeStart, resizing, resizeStop, inlineClick, cellSelect, virtualScrollStart, virtualScrollStop, initialLoad, initialEnd, print$1 as print, dataReady, eventsLoaded, contentReady, scroll, virtualScroll, scrollUiUpdate, uiUpdate, documentClick, cellMouseDown, WEEK_LENGTH, DEFAULT_WEEKS, MS_PER_DAY, MS_PER_MINUTE, getElementHeightFromClass, getElementWidthFromClass, getTranslateY, getTranslateX, getWeekFirstDate, getWeekLastDate, firstDateOfMonth, lastDateOfMonth, getWeekNumber, getWeekMiddleDate, setTime, resetTime, getDateInMs, getDateCount, addDays, addMonths, addYears, getStartEndHours, getMaxDays, getDaysCount, getDateFromString, getScrollBarWidth, resetScrollbarWidth, findIndexInData, getOuterHeight, removeChildren, isDaylightSavingTime, getUniversalTime, isMobile, isIPadDevice, capitalizeFirstWord, Resize, DragAndDrop, HeaderRenderer, ViewBase, Day, Week, WorkWeek, Month, Year, Agenda, MonthAgenda, TimelineViews, TimelineMonth, TimelineYear, Timezone, timezoneData, ICalendarExport, ICalendarImport, ExcelExport, Print, RecurrenceEditor, generateSummary, generate, getDateFromRecurrenceDateString, extractObjectFromRule, getCalendarUtil, getRecurrenceStringFromDate, Gregorian, Islamic };
27562
+ export { Schedule, cellClick, cellDoubleClick, moreEventsClick, select, hover, actionBegin, actionComplete, actionFailure, navigating, renderCell, eventClick, eventDoubleClick, eventRendered, dataBinding, dataBound, popupOpen, popupClose, dragStart, drag, dragStop, resizeStart, resizing, resizeStop, inlineClick, cellSelect, virtualScrollStart, virtualScrollStop, initialLoad, initialEnd, print$1 as print, dataReady, eventsLoaded, contentReady, scroll, virtualScroll, scrollUiUpdate, uiUpdate, documentClick, cellMouseDown, WEEK_LENGTH, DEFAULT_WEEKS, MS_PER_DAY, MS_PER_MINUTE, getElementHeightFromClass, getElementWidthFromClass, getTranslateY, getTranslateX, getWeekFirstDate, getWeekLastDate, firstDateOfMonth, lastDateOfMonth, getWeekNumber, getWeekMiddleDate, setTime, resetTime, getDateInMs, getDateCount, addDays, addMonths, addYears, getStartEndHours, getMaxDays, getDaysCount, getDateFromString, getScrollBarWidth, resetScrollbarWidth, findIndexInData, getOuterHeight, removeChildren, isDaylightSavingTime, getUniversalTime, isMobile, isIPadDevice, capitalizeFirstWord, getElementWidth, getElementHeight, getElementTop, Resize, DragAndDrop, HeaderRenderer, ViewBase, Day, Week, WorkWeek, Month, Year, Agenda, MonthAgenda, TimelineViews, TimelineMonth, TimelineYear, Timezone, timezoneData, ICalendarExport, ICalendarImport, ExcelExport, Print, RecurrenceEditor, generateSummary, generate, getDateFromRecurrenceDateString, extractObjectFromRule, getCalendarUtil, getRecurrenceStringFromDate, Gregorian, Islamic };
27494
27563
  //# sourceMappingURL=ej2-schedule.es2015.js.map