@syncfusion/ej2-schedule 25.2.3 → 25.2.4

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.
@@ -1825,10 +1825,11 @@ var ScheduleTouch = /** @__PURE__ @class */ (function () {
1825
1825
  this.touchRightDirection = this.parent.enableRtl ? 'Left' : 'Right';
1826
1826
  }
1827
1827
  ScheduleTouch.prototype.scrollHandler = function (e) {
1828
- if (this.parent.currentView === 'Agenda' || this.parent.uiStateValues.action || !this.parent.allowSwiping ||
1829
- (e.originalEvent && e.originalEvent.target &&
1830
- (e.originalEvent.target.classList.contains(APPOINTMENT_CLASS) ||
1831
- closest(e.originalEvent.target, '.' + APPOINTMENT_CLASS)) && !this.parent.isAdaptive)) {
1828
+ var blockSwipe = !this.parent.isAdaptive && e.originalEvent && e.originalEvent.target &&
1829
+ !isNullOrUndefined(closest(e.originalEvent.target, '.' + APPOINTMENT_CLASS));
1830
+ this.parent.uiStateValues.isTouchScroll = blockSwipe && e.originalEvent.type === 'touchmove' && !this.parent.uiStateValues.action;
1831
+ if (blockSwipe || this.parent.currentView === 'Agenda' || this.parent.uiStateValues.action || !this.parent.allowSwiping ||
1832
+ this.parent.uiStateValues.isTapHold) {
1832
1833
  return;
1833
1834
  }
1834
1835
  if (!this.timeStampStart) {
@@ -1885,7 +1886,8 @@ var ScheduleTouch = /** @__PURE__ @class */ (function () {
1885
1886
  }
1886
1887
  };
1887
1888
  ScheduleTouch.prototype.swipeHandler = function (e) {
1888
- if (!this.isScrollTriggered || this.parent.uiStateValues.action || !this.parent.allowSwiping) {
1889
+ if (!this.isScrollTriggered || this.parent.uiStateValues.action || !this.parent.allowSwiping ||
1890
+ this.parent.uiStateValues.isTapHold) {
1889
1891
  return;
1890
1892
  }
1891
1893
  this.isScrollTriggered = false;
@@ -1915,11 +1917,27 @@ var ScheduleTouch = /** @__PURE__ @class */ (function () {
1915
1917
  };
1916
1918
  ScheduleTouch.prototype.tapHoldHandler = function (e) {
1917
1919
  var target = closest(e.originalEvent.target, '.' + APPOINTMENT_CLASS);
1918
- if (!isNullOrUndefined(target) && this.parent.isAdaptive) {
1919
- this.parent.quickPopup.tapHoldEventPopup(e.originalEvent);
1920
- return;
1920
+ if (!isNullOrUndefined(target)) {
1921
+ this.parent.uiStateValues.isTapHold = true;
1922
+ if (this.parent.isAdaptive) {
1923
+ if (Browser.isIos) {
1924
+ EventHandler.add(this.element, 'touchend', this.preventEventClick, this);
1925
+ }
1926
+ this.parent.quickPopup.tapHoldEventPopup(e.originalEvent);
1927
+ }
1928
+ else if (['Agenda', 'MonthAgenda', 'Year'].indexOf(this.parent.currentView) < 0) {
1929
+ this.parent.selectedElements = [];
1930
+ this.parent.eventBase.getSelectedEventElements(target);
1931
+ if (this.parent.resizeModule && closest(e.originalEvent.target, '.' + EVENT_RESIZE_CLASS)) {
1932
+ this.parent.resizeModule.resizeStart(e.originalEvent);
1933
+ }
1934
+ }
1921
1935
  }
1922
1936
  };
1937
+ ScheduleTouch.prototype.preventEventClick = function (e) {
1938
+ e.preventDefault();
1939
+ EventHandler.remove(this.element, 'touchend', this.preventEventClick);
1940
+ };
1923
1941
  ScheduleTouch.prototype.renderPanel = function (clsName, nextPrevType) {
1924
1942
  if (!this.currentPanel) {
1925
1943
  this.currentPanel = {
@@ -6138,6 +6156,10 @@ var EventBase = /** @__PURE__ @class */ (function () {
6138
6156
  }
6139
6157
  }
6140
6158
  else if (!closest(element, '.' + POPUP_OPEN)) {
6159
+ if (this.parent.uiStateValues.isTapHold && closest(element, '.' + WORK_CELLS_CLASS + ',.' + ALLDAY_CELLS_CLASS)) {
6160
+ return;
6161
+ }
6162
+ this.parent.uiStateValues.isTapHold = false;
6141
6163
  this.removeSelectedAppointmentClass();
6142
6164
  this.parent.selectedElements = [];
6143
6165
  }
@@ -6147,7 +6169,7 @@ var EventBase = /** @__PURE__ @class */ (function () {
6147
6169
  var isReadOnly = (!isNullOrUndefined(event)) ? event[this.parent.eventFields.isReadonly] : false;
6148
6170
  EventHandler.add(element, 'click', this.eventClick, this);
6149
6171
  if (!this.parent.isAdaptive && !this.parent.activeViewOptions.readonly && !isReadOnly) {
6150
- EventHandler.add(element, 'touchstart', this.eventTouchClick, this);
6172
+ EventHandler.add(element, 'touchend', this.eventTouchClick, this);
6151
6173
  EventHandler.add(element, 'dblclick', this.eventDoubleClick, this);
6152
6174
  }
6153
6175
  if (!this.parent.activeViewOptions.readonly && !isReadOnly && !isPreventCrud) {
@@ -6161,6 +6183,10 @@ var EventBase = /** @__PURE__ @class */ (function () {
6161
6183
  };
6162
6184
  EventBase.prototype.eventTouchClick = function (e) {
6163
6185
  var _this = this;
6186
+ if (this.parent.uiStateValues.isTouchScroll || this.parent.uiStateValues.isTapHold || this.parent.uiStateValues.action) {
6187
+ this.parent.uiStateValues.isTouchScroll = this.parent.uiStateValues.isTapHold = false;
6188
+ return;
6189
+ }
6164
6190
  setTimeout(function () { return _this.isDoubleTapped = false; }, 250);
6165
6191
  e.preventDefault();
6166
6192
  if (this.isDoubleTapped) {
@@ -6274,7 +6300,7 @@ var EventBase = /** @__PURE__ @class */ (function () {
6274
6300
  if (this.parent.quickPopup) {
6275
6301
  this.parent.quickPopup.quickPopupHide(true);
6276
6302
  }
6277
- if (eventData.type === 'touchstart') {
6303
+ if (eventData.type === 'touchend') {
6278
6304
  this.activeEventData(eventData, true);
6279
6305
  }
6280
6306
  this.removeSelectedAppointmentClass();
@@ -6590,8 +6616,8 @@ var EventBase = /** @__PURE__ @class */ (function () {
6590
6616
  var scheduleId = this.parent.element.id + '_';
6591
6617
  var viewName = this.parent.activeViewOptions.eventTemplateName;
6592
6618
  var templateId = scheduleId + viewName + 'eventTemplate';
6593
- var templateName = 'eventTemplate' + (isResourceEventTemplate &&
6594
- this.parent.currentView.indexOf('Year') === -1 ? '_' + resIndex : '');
6619
+ var templateName = isResourceEventTemplate && this.parent.currentView.indexOf('Year') === -1 ?
6620
+ this.parent.getEventTemplateName(resIndex) : 'eventTemplate';
6595
6621
  templateElement = this.parent.getAppointmentTemplate()(record, this.parent, templateName, templateId, false);
6596
6622
  }
6597
6623
  else {
@@ -7194,7 +7220,7 @@ var VerticalEvent = /** @__PURE__ @class */ (function (_super) {
7194
7220
  var viewName = this.parent.activeViewOptions.eventTemplateName;
7195
7221
  var templateId = elementId + viewName + 'eventTemplate';
7196
7222
  var resIndex = this.parent.uiStateValues.isGroupAdaptive ? this.parent.uiStateValues.groupIndex : resource;
7197
- var templateName = 'eventTemplate' + (this.isResourceEventTemplate ? '_' + resIndex : '');
7223
+ var templateName = this.isResourceEventTemplate ? this.parent.getEventTemplateName(resIndex) : 'eventTemplate';
7198
7224
  templateElement = this.parent.getAppointmentTemplate()(record, this.parent, templateName, templateId, false);
7199
7225
  }
7200
7226
  else {
@@ -8115,7 +8141,7 @@ var MonthEvent = /** @__PURE__ @class */ (function (_super) {
8115
8141
  var scheduleId = this.parent.element.id + '_';
8116
8142
  var viewName = this.parent.activeViewOptions.eventTemplateName;
8117
8143
  var templateId = scheduleId + viewName + 'eventTemplate';
8118
- var eventTemplate = 'eventTemplate' + (this.isResourceEventTemplate ? '_' + resIndex : '');
8144
+ var eventTemplate = this.isResourceEventTemplate ? this.parent.getEventTemplateName(resIndex) : 'eventTemplate';
8119
8145
  templateElement = this.parent.getAppointmentTemplate()(eventObj, this.parent, eventTemplate, templateId, false);
8120
8146
  }
8121
8147
  else {
@@ -9722,7 +9748,6 @@ var QuickPopups = /** @__PURE__ @class */ (function () {
9722
9748
  };
9723
9749
  QuickPopups.prototype.tapHoldEventPopup = function (e) {
9724
9750
  var target = closest(e.target, '.' + APPOINTMENT_CLASS);
9725
- this.isMultipleEventSelect = false;
9726
9751
  this.parent.selectedElements = [];
9727
9752
  this.isMultipleEventSelect = true;
9728
9753
  this.parent.eventBase.getSelectedEventElements(target);
@@ -14541,10 +14566,17 @@ var Render = /** @__PURE__ @class */ (function () {
14541
14566
  Render.prototype.initializeLayout = function (viewName) {
14542
14567
  if (this.parent.activeView) {
14543
14568
  var templates = [
14544
- 'cellTemplate', 'eventTemplate', 'tooltipTemplate', 'majorSlotTemplate', 'minorSlotTemplate',
14569
+ 'cellTemplate', 'tooltipTemplate', 'majorSlotTemplate', 'minorSlotTemplate',
14545
14570
  'headerTooltipTemplate', 'dateHeaderTemplate', 'dayHeaderTemplate', 'monthHeaderTemplate',
14546
14571
  'headerIndentTemplate', 'resourceHeaderTemplate', 'cellHeaderTemplate', 'dateRangeTemplate'
14547
14572
  ];
14573
+ if (this.parent.activeEventTemplates.length > 0) {
14574
+ templates = templates.concat(this.parent.activeEventTemplates);
14575
+ this.parent.activeEventTemplates = [];
14576
+ }
14577
+ else {
14578
+ templates.push('eventTemplate');
14579
+ }
14548
14580
  this.parent.resetTemplates(templates);
14549
14581
  this.parent.activeView.removeEventListener();
14550
14582
  this.parent.activeView.destroy();
@@ -15604,6 +15636,13 @@ var WorkCellInteraction = /** @__PURE__ @class */ (function () {
15604
15636
  this.parent.eventWindow.openEditor(this.parent.activeCellsData, 'Add');
15605
15637
  return;
15606
15638
  }
15639
+ var isWorkCell = target.classList.contains(WORK_CELLS_CLASS) ||
15640
+ target.classList.contains(ALLDAY_CELLS_CLASS);
15641
+ if (this.parent.uiStateValues.isTapHold && !this.parent.uiStateValues.action && isWorkCell) {
15642
+ this.parent.uiStateValues.isTapHold = false;
15643
+ this.parent.eventBase.removeSelectedAppointmentClass();
15644
+ this.parent.selectedElements = [];
15645
+ }
15607
15646
  var navigateEle = closest(e.target, '.' + NAVIGATE_CLASS);
15608
15647
  var navigateView = this.parent.getNavigateView();
15609
15648
  var sameView = this.parent.currentView === navigateView;
@@ -15619,9 +15658,7 @@ var WorkCellInteraction = /** @__PURE__ @class */ (function () {
15619
15658
  closest(e.target, '.' + MORE_INDICATOR_CLASS))) {
15620
15659
  return;
15621
15660
  }
15622
- var isWorkCell_1 = target.classList.contains(WORK_CELLS_CLASS) ||
15623
- target.classList.contains(ALLDAY_CELLS_CLASS);
15624
- if (isWorkCell_1 && e.shiftKey && e.which === 1 && this.parent.keyboardInteractionModule) {
15661
+ if (isWorkCell && e.shiftKey && e.which === 1 && this.parent.keyboardInteractionModule) {
15625
15662
  this.parent.keyboardInteractionModule.onMouseSelection(e);
15626
15663
  return;
15627
15664
  }
@@ -15629,7 +15666,7 @@ var WorkCellInteraction = /** @__PURE__ @class */ (function () {
15629
15666
  var args = extend(this.parent.activeCellsData, { cancel: false, event: e, name: 'cellClick' });
15630
15667
  this.parent.trigger(cellClick, args, function (clickArgs) {
15631
15668
  if (!clickArgs.cancel) {
15632
- if (isWorkCell_1) {
15669
+ if (isWorkCell) {
15633
15670
  _this.parent.selectCell(target);
15634
15671
  }
15635
15672
  if (_this.parent.allowInline) {
@@ -15699,7 +15736,7 @@ var WorkCellInteraction = /** @__PURE__ @class */ (function () {
15699
15736
  return true;
15700
15737
  }
15701
15738
  target = closest(e.target, '.' + HEADER_CELLS_CLASS);
15702
- if (this.parent.activeView.isTimelineView() && !isNullOrUndefined(target)) {
15739
+ if (this.parent.activeView && this.parent.activeView.isTimelineView() && !isNullOrUndefined(target)) {
15703
15740
  return true;
15704
15741
  }
15705
15742
  return false;
@@ -16934,8 +16971,9 @@ var ResourceBase = /** @__PURE__ @class */ (function () {
16934
16971
  ResourceBase.prototype.getResourceRenderDates = function () {
16935
16972
  // eslint-disable-next-line prefer-spread
16936
16973
  var resourceDates = [].concat.apply([], this.lastResourceLevel.map(function (e) { return e.renderDates; }));
16974
+ var time = resourceDates.map(function (dateObj) { return dateObj.getTime(); });
16937
16975
  var removeDuplicateDates = function (dateColl) { return dateColl.filter(function (date, index, dates) {
16938
- return dates.map(function (dateObj) { return dateObj.getTime(); }).indexOf(date.getTime()) === index;
16976
+ return time.indexOf(date.getTime()) === index;
16939
16977
  }); };
16940
16978
  var renderDates = removeDuplicateDates(resourceDates);
16941
16979
  renderDates.sort(function (a, b) { return a.getTime() - b.getTime(); });
@@ -17115,7 +17153,8 @@ var ResourceBase = /** @__PURE__ @class */ (function () {
17115
17153
  index = resource.dataSource.map(function (e) { return e[resource.idField]; }).indexOf(id);
17116
17154
  }
17117
17155
  }
17118
- var offsetTarget = this.parent.element.querySelector("." + HEADER_ROW_CLASS + ":nth-child(" + (levelIndex + 1) + ")");
17156
+ var offsetTarget = this.parent.currentView === 'Month' ? this.parent.element.querySelector("." + DATE_HEADER_WRAP_CLASS + " tbody tr:nth-child(" + (levelIndex + 1) + ")")
17157
+ : this.parent.element.querySelector("." + HEADER_ROW_CLASS + ":nth-child(" + (levelIndex + 1) + ")");
17119
17158
  var offset = [].slice.call(offsetTarget.children).map(function (node) { return node.offsetLeft; });
17120
17159
  scrollElement.scrollLeft = offset[parseInt(index.toString(), 10)];
17121
17160
  }
@@ -17341,6 +17380,13 @@ var Schedule = /** @__PURE__ @class */ (function (_super) {
17341
17380
  this.element.appendChild(this.createElement('div', { className: TABLE_CONTAINER_CLASS }));
17342
17381
  }
17343
17382
  };
17383
+ Schedule.prototype.getEventTemplateName = function (resIndex) {
17384
+ var templateName = 'eventTemplate_' + resIndex;
17385
+ if (this.activeEventTemplates.indexOf(templateName) < 0) {
17386
+ this.activeEventTemplates.push(templateName);
17387
+ }
17388
+ return templateName;
17389
+ };
17344
17390
  /**
17345
17391
  * Method to render react templates
17346
17392
  *
@@ -17937,6 +17983,7 @@ var Schedule = /** @__PURE__ @class */ (function (_super) {
17937
17983
  this.resourceCollection = [];
17938
17984
  this.currentAction = null;
17939
17985
  this.selectedElements = [];
17986
+ this.activeEventTemplates = [];
17940
17987
  this.setViewOptions();
17941
17988
  };
17942
17989
  Schedule.prototype.getDefaultLocale = function () {
@@ -18407,7 +18454,7 @@ var Schedule = /** @__PURE__ @class */ (function (_super) {
18407
18454
  };
18408
18455
  Schedule.prototype.onScheduleResize = function () {
18409
18456
  if (isNullOrUndefined(this.activeView) || ((this.isAdaptive || isMobile()) && document.activeElement
18410
- && document.activeElement.classList.contains(SUBJECT_CLASS))) {
18457
+ && document.activeElement.classList.contains(SUBJECT_CLASS)) || this.uiStateValues.isTapHold) {
18411
18458
  return;
18412
18459
  }
18413
18460
  if (this.virtualScrollModule && this.activeView.isTimelineView()) {
@@ -20788,6 +20835,10 @@ var Resize = /** @__PURE__ @class */ (function (_super) {
20788
20835
  };
20789
20836
  Resize.prototype.resizeStart = function (e) {
20790
20837
  var _this = this;
20838
+ if (e && e.type === 'touchstart' && (!this.parent.uiStateValues.isTapHold ||
20839
+ !closest(e.target, '.' + APPOINTMENT_BORDER))) {
20840
+ return;
20841
+ }
20791
20842
  this.actionObj.action = 'resize';
20792
20843
  this.actionObj.slotInterval = this.parent.activeViewOptions.timeScale.interval / this.parent.activeViewOptions.timeScale.slotCount;
20793
20844
  this.actionObj.interval = this.actionObj.slotInterval;
@@ -20852,6 +20903,9 @@ var Resize = /** @__PURE__ @class */ (function (_super) {
20852
20903
  });
20853
20904
  };
20854
20905
  Resize.prototype.resizing = function (e) {
20906
+ if (e && e.type === 'touchmove') {
20907
+ e.preventDefault();
20908
+ }
20855
20909
  if (this.parent.quickPopup) {
20856
20910
  this.parent.quickPopup.quickPopupHide();
20857
20911
  }
@@ -21047,7 +21101,7 @@ var Resize = /** @__PURE__ @class */ (function (_super) {
21047
21101
  this.removeCloneElementClasses();
21048
21102
  this.removeCloneElement();
21049
21103
  this.actionClass('removeClass');
21050
- this.parent.uiStateValues.action = false;
21104
+ this.parent.uiStateValues.action = this.parent.uiStateValues.isTapHold = false;
21051
21105
  var resizeArgs = { cancel: false, data: this.getChangedData(), element: this.actionObj.element, event: e };
21052
21106
  this.parent.trigger(resizeStop, resizeArgs, function (resizeEventArgs) {
21053
21107
  if (resizeEventArgs.cancel) {
@@ -22016,7 +22070,6 @@ var DragAndDrop = /** @__PURE__ @class */ (function (_super) {
22016
22070
  abort: '.' + EVENT_RESIZE_CLASS,
22017
22071
  clone: true,
22018
22072
  isDragScroll: true,
22019
- enableTapHold: this.parent.isAdaptive,
22020
22073
  enableTailMode: (this.parent.eventDragArea) ? true : false,
22021
22074
  cursorAt: (this.parent.eventDragArea) ? { left: -20, top: -20 } : { left: 0, top: 0 },
22022
22075
  dragArea: this.dragArea,
@@ -22035,6 +22088,10 @@ var DragAndDrop = /** @__PURE__ @class */ (function (_super) {
22035
22088
  };
22036
22089
  DragAndDrop.prototype.dragHelper = function (e) {
22037
22090
  var _this = this;
22091
+ if (e.sender && e.sender.type === 'touchmove' && (!this.parent.uiStateValues.isTapHold ||
22092
+ !e.element.classList.contains(APPOINTMENT_BORDER))) {
22093
+ return null;
22094
+ }
22038
22095
  this.setDragActionDefaultValues();
22039
22096
  this.actionObj.element = e.element;
22040
22097
  this.actionObj.action = 'drag';
@@ -22245,6 +22302,9 @@ var DragAndDrop = /** @__PURE__ @class */ (function (_super) {
22245
22302
  return this.multiData;
22246
22303
  };
22247
22304
  DragAndDrop.prototype.drag = function (e) {
22305
+ if (e.event && e.event.type === 'touchmove') {
22306
+ e.event.preventDefault();
22307
+ }
22248
22308
  if (this.parent.quickPopup) {
22249
22309
  this.parent.quickPopup.quickPopupHide(true);
22250
22310
  }
@@ -22335,7 +22395,7 @@ var DragAndDrop = /** @__PURE__ @class */ (function (_super) {
22335
22395
  clearInterval(this.actionObj.scrollInterval);
22336
22396
  this.actionObj.scrollInterval = null;
22337
22397
  this.actionClass('removeClass');
22338
- this.parent.uiStateValues.action = false;
22398
+ this.parent.uiStateValues.action = this.parent.uiStateValues.isTapHold = false;
22339
22399
  if (this.isAllowDrop(e)) {
22340
22400
  return;
22341
22401
  }
@@ -23950,7 +24010,7 @@ var VerticalView = /** @__PURE__ @class */ (function (_super) {
23950
24010
  this.parent.uiStateValues.top = target.scrollTop;
23951
24011
  }
23952
24012
  this.parent.uiStateValues.left = target.scrollLeft;
23953
- if (!isNullOrUndefined(this.parent.quickPopup)) {
24013
+ if (!isNullOrUndefined(this.parent.quickPopup) && !this.parent.uiStateValues.isTapHold) {
23954
24014
  this.parent.quickPopup.quickPopupHide();
23955
24015
  }
23956
24016
  this.setPersistence();
@@ -24319,6 +24379,10 @@ var VerticalView = /** @__PURE__ @class */ (function (_super) {
24319
24379
  remove(this.element.querySelector('tbody tr'));
24320
24380
  this.renderHeader();
24321
24381
  this.parent.notify(contentReady, {});
24382
+ var dateHeader = this.element.querySelector('.' + DATE_HEADER_WRAP_CLASS);
24383
+ if (dateHeader) {
24384
+ dateHeader.scrollLeft = this.parent.uiStateValues.left;
24385
+ }
24322
24386
  };
24323
24387
  VerticalView.prototype.renderLayout = function (type) {
24324
24388
  this.setPanel(createElement('div', { className: TABLE_WRAP_CLASS }));
@@ -25089,6 +25153,10 @@ var Month = /** @__PURE__ @class */ (function (_super) {
25089
25153
  remove(this.element.querySelector('tbody tr'));
25090
25154
  this.renderHeader();
25091
25155
  this.parent.notify(contentReady, {});
25156
+ var dateHeader = this.element.querySelector('.' + DATE_HEADER_WRAP_CLASS);
25157
+ if (dateHeader) {
25158
+ dateHeader.scrollLeft = this.parent.uiStateValues.left;
25159
+ }
25092
25160
  };
25093
25161
  Month.prototype.wireCellEvents = function (element) {
25094
25162
  EventHandler.add(element, 'mousedown', this.parent.workCellAction.cellMouseDown, this.parent.workCellAction);