@syncfusion/ej2-schedule 20.4.44 → 20.4.49

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 (52) hide show
  1. package/CHANGELOG.md +17 -1
  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 +56 -27
  6. package/dist/es6/ej2-schedule.es2015.js.map +1 -1
  7. package/dist/es6/ej2-schedule.es5.js +56 -27
  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 +15 -15
  13. package/src/schedule/actions/action-base.d.ts +0 -1
  14. package/src/schedule/actions/action-base.js +1 -6
  15. package/src/schedule/actions/drag.js +4 -3
  16. package/src/schedule/actions/resize.js +3 -3
  17. package/src/schedule/actions/touch.js +2 -1
  18. package/src/schedule/event-renderer/event-base.d.ts +2 -0
  19. package/src/schedule/event-renderer/event-base.js +28 -4
  20. package/src/schedule/popups/event-window.js +1 -1
  21. package/src/schedule/popups/quick-popups.js +17 -9
  22. package/styles/bootstrap-dark.css +1 -1
  23. package/styles/bootstrap.css +1 -1
  24. package/styles/bootstrap4.css +1 -1
  25. package/styles/bootstrap5-dark.css +1 -1
  26. package/styles/bootstrap5.css +1 -1
  27. package/styles/fabric-dark.css +1 -1
  28. package/styles/fabric.css +1 -1
  29. package/styles/fluent-dark.css +1 -1
  30. package/styles/fluent.css +1 -1
  31. package/styles/highcontrast-light.css +1 -1
  32. package/styles/highcontrast.css +1 -1
  33. package/styles/material-dark.css +1 -1
  34. package/styles/material.css +1 -1
  35. package/styles/schedule/_layout.scss +1 -1
  36. package/styles/schedule/bootstrap-dark.css +1 -1
  37. package/styles/schedule/bootstrap.css +1 -1
  38. package/styles/schedule/bootstrap4.css +1 -1
  39. package/styles/schedule/bootstrap5-dark.css +1 -1
  40. package/styles/schedule/bootstrap5.css +1 -1
  41. package/styles/schedule/fabric-dark.css +1 -1
  42. package/styles/schedule/fabric.css +1 -1
  43. package/styles/schedule/fluent-dark.css +1 -1
  44. package/styles/schedule/fluent.css +1 -1
  45. package/styles/schedule/highcontrast-light.css +1 -1
  46. package/styles/schedule/highcontrast.css +1 -1
  47. package/styles/schedule/material-dark.css +1 -1
  48. package/styles/schedule/material.css +1 -1
  49. package/styles/schedule/tailwind-dark.css +1 -1
  50. package/styles/schedule/tailwind.css +1 -1
  51. package/styles/tailwind-dark.css +1 -1
  52. package/styles/tailwind.css +1 -1
@@ -1690,7 +1690,7 @@ class ScheduleTouch {
1690
1690
  if (offsetDist > time || (e.distanceX > (this.parent.element.offsetWidth / 2))) {
1691
1691
  this.swapPanels(e.swipeDirection);
1692
1692
  if (offsetDist > time && (e.distanceX > (this.parent.element.offsetWidth / 2))) {
1693
- this.element.style.transitionDuration = ((offsetDist / time) / 10) + 's';
1693
+ this.element.style.transitionDuration = (((Browser.isDevice ? e.distanceX : offsetDist) / time) / 10) + 's';
1694
1694
  }
1695
1695
  this.confirmSwipe(e.swipeDirection);
1696
1696
  }
@@ -1819,6 +1819,7 @@ class ScheduleTouch {
1819
1819
  this.nextPanel = null;
1820
1820
  this.timeStampStart = null;
1821
1821
  this.element.style.transform = '';
1822
+ this.element.style.transitionDuration = '';
1822
1823
  removeChildren(this.element);
1823
1824
  removeClass([this.element], TRANSLATE_CLASS);
1824
1825
  }
@@ -5424,8 +5425,8 @@ class EventBase {
5424
5425
  return filteredCollection;
5425
5426
  }
5426
5427
  sortByTime(appointmentsCollection) {
5427
- if (this.parent.eventSettings.sortComparer) {
5428
- appointmentsCollection = this.parent.eventSettings.sortComparer.call(this.parent, appointmentsCollection);
5428
+ if (this.parent.eventSettings.sortComparer && (typeof (this.parent.eventSettings.sortComparer) === 'function' || typeof (this.parent.eventSettings.sortComparer) === 'string')) {
5429
+ appointmentsCollection = this.customSorting(appointmentsCollection);
5429
5430
  }
5430
5431
  else {
5431
5432
  const fieldMappings = this.parent.eventFields;
@@ -5438,8 +5439,8 @@ class EventBase {
5438
5439
  return appointmentsCollection;
5439
5440
  }
5440
5441
  sortByDateTime(appointments) {
5441
- if (this.parent.eventSettings.sortComparer) {
5442
- appointments = this.parent.eventSettings.sortComparer.call(this.parent, appointments);
5442
+ if (this.parent.eventSettings.sortComparer && (typeof (this.parent.eventSettings.sortComparer) === 'function' || typeof (this.parent.eventSettings.sortComparer) === 'string')) {
5443
+ appointments = this.customSorting(appointments);
5443
5444
  }
5444
5445
  else {
5445
5446
  const fieldMapping = this.parent.eventFields;
@@ -5455,6 +5456,22 @@ class EventBase {
5455
5456
  }
5456
5457
  return appointments;
5457
5458
  }
5459
+ customSorting(appointments) {
5460
+ if (typeof (this.parent.eventSettings.sortComparer) === 'function') {
5461
+ return this.parent.eventSettings.sortComparer.call(this.parent, appointments);
5462
+ }
5463
+ else if (typeof (this.parent.eventSettings.sortComparer) === 'string') {
5464
+ const splits = this.parent.eventSettings.sortComparer.split('.');
5465
+ let sortFn;
5466
+ if (!isNullOrUndefined(window)) {
5467
+ sortFn = window[splits[splits.length - 1]];
5468
+ }
5469
+ if (sortFn) {
5470
+ return sortFn(appointments);
5471
+ }
5472
+ }
5473
+ return appointments;
5474
+ }
5458
5475
  getSmallestMissingNumber(array) {
5459
5476
  const large = Math.max(...array);
5460
5477
  for (let i = 0; i < large; i++) {
@@ -6372,6 +6389,14 @@ class EventBase {
6372
6389
  }
6373
6390
  return tr;
6374
6391
  }
6392
+ getPageCoordinates(e) {
6393
+ if (isNullOrUndefined(e)) {
6394
+ return e;
6395
+ }
6396
+ const eventArgs = e.event;
6397
+ return eventArgs && eventArgs.changedTouches ? eventArgs.changedTouches[0] : e.changedTouches ? e.changedTouches[0] :
6398
+ eventArgs || e;
6399
+ }
6375
6400
  unWireEvents() {
6376
6401
  const appElements = [].slice.call(this.parent.element.querySelectorAll('.' + APPOINTMENT_CLASS));
6377
6402
  for (const element of appElements) {
@@ -9129,7 +9154,7 @@ class QuickPopups {
9129
9154
  if (deleteIcon) {
9130
9155
  this.renderButton('e-flat e-round e-small', ICON + ' ' + DELETE_ICON_CLASS, deleteAction, deleteIcon, this.deleteClick);
9131
9156
  }
9132
- this.beforeQuickPopupOpen(target, e);
9157
+ this.beforeQuickPopupOpen(target, this.parent.eventBase.getPageCoordinates(e));
9133
9158
  }
9134
9159
  isCellBlocked(args) {
9135
9160
  const tempObj = {};
@@ -9216,7 +9241,7 @@ class QuickPopups {
9216
9241
  this.quickPopup.content = quickCellPopup;
9217
9242
  this.quickPopup.relateTo = target;
9218
9243
  this.quickPopup.dataBind();
9219
- this.beforeQuickPopupOpen(target, args.event);
9244
+ this.beforeQuickPopupOpen(target, this.parent.eventBase.getPageCoordinates(args.event));
9220
9245
  }
9221
9246
  isSameEventClick(events) {
9222
9247
  const isSameTarget = this.quickPopup.relateTo === closest(events.element, '.' + APPOINTMENT_CLASS);
@@ -9293,7 +9318,7 @@ class QuickPopups {
9293
9318
  this.quickPopup.relateTo = this.parent.isAdaptive ? document.body :
9294
9319
  closest(events.element, '.' + APPOINTMENT_CLASS);
9295
9320
  this.quickPopup.dataBind();
9296
- this.beforeQuickPopupOpen(events.element, events.originalEvent);
9321
+ this.beforeQuickPopupOpen(events.element, this.parent.eventBase.getPageCoordinates(events.originalEvent));
9297
9322
  }
9298
9323
  }
9299
9324
  getPopupHeader(headerType, headerData) {
@@ -9825,22 +9850,30 @@ class QuickPopups {
9825
9850
  this.quickPopup.dataBind();
9826
9851
  this.quickPopup.refreshPosition(null, true);
9827
9852
  }
9828
- if (this.quickPopup.position.X === 'center' && this.quickPopup.position.Y === 'center' && !isNullOrUndefined(originalEvent)) {
9853
+ if (this.quickPopup.position.X === 'center' && this.quickPopup.position.Y === 'center' && !isNullOrUndefined(originalEvent) &&
9854
+ originalEvent.clientX && originalEvent.clientY) {
9855
+ const clientX = originalEvent.clientX;
9856
+ const clientY = originalEvent.clientY;
9857
+ const targetRect = target.getBoundingClientRect();
9858
+ const offsetY = originalEvent.offsetY || Math.ceil(clientY - targetRect.y);
9829
9859
  const previousOffset = this.quickPopup.offsetY;
9830
- let collision = isCollide(target, this.quickPopup.element);
9860
+ let collision = isCollide(this.quickPopup.element, target);
9831
9861
  const popupRect = this.quickPopup.element.getBoundingClientRect();
9832
- if (collision.indexOf('top') > -1 || collision.indexOf('bottom') > -1) {
9833
- if (popupRect.top <= originalEvent.clientY && originalEvent.clientY <= popupRect.top + popupRect.height) {
9862
+ const targetEle = document.elementFromPoint(clientX, clientY);
9863
+ if (collision.indexOf('top') > -1 || collision.indexOf('bottom') > -1 || closest(targetEle, '.' + POPUP_WRAPPER_CLASS)) {
9864
+ if (popupRect.top <= clientY &&
9865
+ clientY <= popupRect.top + popupRect.height) {
9834
9866
  this.quickPopup.offsetY = previousOffset - popupRect.height - 10;
9835
9867
  this.quickPopup.dataBind();
9836
9868
  collision = isCollide(this.quickPopup.element, this.parent.element);
9837
9869
  if (collision.indexOf('top') > -1) {
9838
- this.quickPopup.offsetY = previousOffset + originalEvent.offsetY;
9870
+ this.quickPopup.offsetY = previousOffset + offsetY + 10;
9839
9871
  this.quickPopup.dataBind();
9840
9872
  }
9841
9873
  }
9842
9874
  else if (isCollide(this.quickPopup.element, this.parent.element).indexOf('bottom') > -1) {
9843
- this.quickPopup.offsetY = previousOffset - originalEvent.offsetY - Math.ceil(popupRect.height) - 10;
9875
+ this.quickPopup.offsetY =
9876
+ previousOffset - offsetY - Math.ceil(popupRect.height) - 10;
9844
9877
  this.quickPopup.dataBind();
9845
9878
  }
9846
9879
  }
@@ -12823,7 +12856,7 @@ class EventWindow {
12823
12856
  resourceSaveEvent(eventObj, action, currentAction) {
12824
12857
  const lastResourceData = this.parent.resourceBase.resourceCollection.slice(-1)[0];
12825
12858
  let resourceData = eventObj[lastResourceData.field];
12826
- resourceData = (resourceData instanceof Array) ? resourceData : [resourceData];
12859
+ resourceData = (resourceData instanceof Array) ? resourceData.reverse() : [resourceData].reverse();
12827
12860
  const lastLevel = this.parent.resourceBase.lastResourceLevel;
12828
12861
  const eventList = [];
12829
12862
  for (let i = 0; i < resourceData.length; i++) {
@@ -18772,11 +18805,6 @@ class ActionBase {
18772
18805
  };
18773
18806
  return viewDimension;
18774
18807
  }
18775
- getPageCoordinates(e) {
18776
- const eventArgs = e.event;
18777
- return eventArgs && eventArgs.changedTouches ? eventArgs.changedTouches[0] : e.changedTouches ? e.changedTouches[0] :
18778
- eventArgs || e;
18779
- }
18780
18808
  getIndex(index) {
18781
18809
  const contentElements = [].slice.call(this.parent.getContentTable().querySelector('tr').children);
18782
18810
  const indexes = { minIndex: 0, maxIndex: contentElements.length - 1 };
@@ -18907,7 +18935,7 @@ class ActionBase {
18907
18935
  }
18908
18936
  }
18909
18937
  getCursorElement(e) {
18910
- const pages = this.getPageCoordinates(e);
18938
+ const pages = this.parent.eventBase.getPageCoordinates(e);
18911
18939
  return document.elementFromPoint(pages.clientX, pages.clientY);
18912
18940
  }
18913
18941
  autoScroll() {
@@ -19181,7 +19209,7 @@ class Resize extends ActionBase {
19181
19209
  this.actionObj.cellWidth = trRect.width / noOfDays;
19182
19210
  this.actionObj.cellHeight = trRect.height;
19183
19211
  }
19184
- const pages = this.getPageCoordinates(e);
19212
+ const pages = this.parent.eventBase.getPageCoordinates(e);
19185
19213
  this.actionObj.X = pages.pageX;
19186
19214
  this.actionObj.Y = pages.pageY;
19187
19215
  this.actionObj.groupIndex = parseInt(this.actionObj.element.getAttribute('data-group-index') || '0', 10);
@@ -19210,7 +19238,7 @@ class Resize extends ActionBase {
19210
19238
  if ((!isNullOrUndefined(e.target)) && e.target.classList.contains(DISABLE_DATES)) {
19211
19239
  return;
19212
19240
  }
19213
- const pages = this.getPageCoordinates(e);
19241
+ const pages = this.parent.eventBase.getPageCoordinates(e);
19214
19242
  if (this.parent.currentView === 'Month' || this.parent.currentView === 'TimelineYear') {
19215
19243
  const doc = document.documentElement;
19216
19244
  const left = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0);
@@ -19636,7 +19664,7 @@ class Resize extends ActionBase {
19636
19664
  return styles;
19637
19665
  }
19638
19666
  resizeValidation(e) {
19639
- const pages = this.getPageCoordinates(e);
19667
+ const pages = this.parent.eventBase.getPageCoordinates(e);
19640
19668
  const viewDimension = this.getContentAreaDimension();
19641
19669
  const isTimeScale = this.parent.activeView.isTimelineView() && this.parent.activeViewOptions.timeScale.enable;
19642
19670
  let cellWidth = this.actionObj.cellWidth;
@@ -20433,7 +20461,7 @@ class DragAndDrop extends ActionBase {
20433
20461
  return;
20434
20462
  }
20435
20463
  const eventObj = extend({}, this.actionObj.event, null, true);
20436
- const eventArgs = this.getPageCoordinates(e);
20464
+ const eventArgs = this.parent.eventBase.getPageCoordinates(e);
20437
20465
  this.actionObj.Y = this.actionObj.pageY = eventArgs.pageY;
20438
20466
  this.actionObj.X = this.actionObj.pageX = eventArgs.pageX;
20439
20467
  this.actionObj.target = e.target;
@@ -20574,7 +20602,8 @@ class DragAndDrop extends ActionBase {
20574
20602
  this.timelineEventModule.dateRender = this.parent.activeView.renderDates;
20575
20603
  this.timelineEventModule.cellWidth = this.actionObj.cellWidth;
20576
20604
  this.timelineEventModule.getSlotDates();
20577
- this.actionObj.cellWidth = this.isHeaderRows ? this.timelineEventModule.cellWidth : this.actionObj.cellWidth;
20605
+ this.actionObj.cellWidth = this.isHeaderRows ? this.timelineEventModule.cellWidth :
20606
+ this.parent.element.querySelector('.' + WORK_CELLS_CLASS).getBoundingClientRect().width;
20578
20607
  this.calculateTimelineTime(e);
20579
20608
  }
20580
20609
  else {
@@ -21320,7 +21349,7 @@ class DragAndDrop extends ActionBase {
21320
21349
  return 0;
21321
21350
  }
21322
21351
  getColumnIndex(offsetLeft) {
21323
- const index = Math.floor(offsetLeft / this.actionObj.cellWidth);
21352
+ const index = Math.floor(offsetLeft / Math.trunc(this.actionObj.cellWidth));
21324
21353
  if (this.isHeaderRows) {
21325
21354
  return index;
21326
21355
  }