@syncfusion/ej2-schedule 24.2.3 → 24.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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 24.2.3
3
+ * version : 24.2.4
4
4
  * Copyright Syncfusion Inc. 2001 - 2023. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "_from": "@syncfusion/ej2-schedule@*",
3
- "_id": "@syncfusion/ej2-schedule@24.1.41",
3
+ "_id": "@syncfusion/ej2-schedule@24.2.3",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-PMFUzrOa5gFauoO79WYC7vNHSJIoHrPUZJwE/aDZPIKkc0pUdaPPcJhLrxMUrKEOLJvmhVo0bqOQkMwUXLswTA==",
5
+ "_integrity": "sha512-Gl514rzz50QthXreUYNs3USTKmeufyBVrP23DMVahPJiR8tVS8350GXUgGOhvsVaHn5NmtgDvqcqB3StCeJZxw==",
6
6
  "_location": "/@syncfusion/ej2-schedule",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -23,8 +23,8 @@
23
23
  "/@syncfusion/ej2-react-schedule",
24
24
  "/@syncfusion/ej2-vue-schedule"
25
25
  ],
26
- "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-schedule/-/ej2-schedule-24.1.41.tgz",
27
- "_shasum": "dfaee919781c2f41866763e373d84a7f4e8b46ad",
26
+ "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-schedule/-/ej2-schedule-24.2.3.tgz",
27
+ "_shasum": "68cf18dacb39bf44d0164f3b73fdb185aae9fbd4",
28
28
  "_spec": "@syncfusion/ej2-schedule@*",
29
29
  "_where": "/jenkins/workspace/elease-automation_release_24.1.1/packages/included",
30
30
  "author": {
@@ -39,11 +39,11 @@
39
39
  "@syncfusion/ej2-buttons": "~24.2.3",
40
40
  "@syncfusion/ej2-calendars": "~24.2.3",
41
41
  "@syncfusion/ej2-data": "~24.2.3",
42
- "@syncfusion/ej2-dropdowns": "~24.2.3",
43
- "@syncfusion/ej2-excel-export": "~24.2.3",
44
- "@syncfusion/ej2-inputs": "~24.2.3",
45
- "@syncfusion/ej2-lists": "~24.2.3",
46
- "@syncfusion/ej2-navigations": "~24.2.3",
42
+ "@syncfusion/ej2-dropdowns": "~24.2.4",
43
+ "@syncfusion/ej2-excel-export": "~24.2.4",
44
+ "@syncfusion/ej2-inputs": "~24.2.4",
45
+ "@syncfusion/ej2-lists": "~24.2.4",
46
+ "@syncfusion/ej2-navigations": "~24.2.4",
47
47
  "@syncfusion/ej2-popups": "~24.2.3"
48
48
  },
49
49
  "deprecated": false,
@@ -73,6 +73,6 @@
73
73
  "url": "git+https://github.com/syncfusion/ej2-javascript-ui-controls.git"
74
74
  },
75
75
  "typings": "index.d.ts",
76
- "version": "24.2.3",
76
+ "version": "24.2.4",
77
77
  "sideEffects": false
78
78
  }
@@ -1057,13 +1057,20 @@ var DragAndDrop = /** @class */ (function (_super) {
1057
1057
  if (this.isStepDragging) {
1058
1058
  var widthDiff = this.getWidthDiff(tr, index);
1059
1059
  if (widthDiff !== 0) {
1060
- var timeDiff = Math.round(widthDiff / this.widthPerMinute);
1060
+ var timeDiff = Math.ceil(widthDiff / this.widthPerMinute);
1061
1061
  eventStart.setMinutes(eventStart.getMinutes() + (timeDiff * this.actionObj.interval));
1062
1062
  if (this.isCursorAhead || cursorDrag) {
1063
1063
  eventStart.setMilliseconds(-(eventDuration));
1064
1064
  }
1065
1065
  else {
1066
1066
  eventStart.setMinutes(eventStart.getMinutes() - this.minDiff);
1067
+ var intervalInMS = this.actionObj.interval * util.MS_PER_MINUTE;
1068
+ timeDiff = Math.abs(eventStart.getTime() - this.actionObj.start.getTime()) / intervalInMS;
1069
+ var roundTimeDiff = Math.trunc(timeDiff);
1070
+ if (roundTimeDiff !== timeDiff) {
1071
+ timeDiff = (roundTimeDiff * intervalInMS) * (eventStart > this.actionObj.start ? 1 : -1);
1072
+ eventStart = new Date(this.actionObj.start.getTime() + timeDiff);
1073
+ }
1067
1074
  }
1068
1075
  }
1069
1076
  else {
@@ -1084,7 +1091,9 @@ var DragAndDrop = /** @class */ (function (_super) {
1084
1091
  (this.cursorPointIndex * (this.isTimelineDayProcess ? MINUTES_PER_DAY : this.actionObj.slotInterval)));
1085
1092
  }
1086
1093
  }
1087
- eventStart = this.calculateIntervalTime(eventStart);
1094
+ if (!this.isStepDragging) {
1095
+ eventStart = this.calculateIntervalTime(eventStart);
1096
+ }
1088
1097
  if (this.isTimelineDayProcess) {
1089
1098
  var eventSrt = eventObj[this.parent.eventFields.startTime];
1090
1099
  eventStart.setHours(eventSrt.getHours(), eventSrt.getMinutes(), eventSrt.getSeconds());
@@ -507,7 +507,12 @@ var Resize = /** @class */ (function (_super) {
507
507
  var left = (this.parent.enableRtl) ? parseInt(this.actionObj.element.style.right, 10) : this.actionObj.clone.offsetLeft;
508
508
  if (isTimeViews) {
509
509
  offsetWidth = targetWidth + (Math.ceil(pageWidth / slotInterval) * slotInterval);
510
- offsetWidth = (Math.round((left + offsetWidth) / slotInterval) * slotInterval) - left;
510
+ if (!isLeft) {
511
+ var roundedLeft = (+parseFloat(this.actionObj.element.style[this.parent.enableRtl ? 'right' : 'left'])).toFixed(1);
512
+ if (roundedLeft !== left.toFixed(1)) {
513
+ offsetWidth = (Math.round((left + offsetWidth) / slotInterval) * slotInterval) - left;
514
+ }
515
+ }
511
516
  this.actionObj.event[this.parent.eventFields.isAllDay] = false;
512
517
  }
513
518
  var width = !isLeft && ((offsetWidth + this.actionObj.clone.offsetLeft > this.scrollArgs.width)) ?
@@ -517,9 +522,11 @@ var Resize = /** @class */ (function (_super) {
517
522
  -(offsetWidth - this.actionObj.cellWidth);
518
523
  rightValue = isTimelineView ? rightValue : isLeft ? 0 : rightValue > 0 ? 0 : rightValue;
519
524
  if (isTimelineView && !isLeft) {
520
- rightValue = Math.ceil((this.actionObj.element.offsetLeft + (this.actionObj.element.getBoundingClientRect().width +
521
- (this.actionObj.pageX - this.actionObj.X))) / slotInterval) * slotInterval;
522
- rightValue = rightValue < 0 ? Math.abs(rightValue) : -rightValue;
525
+ rightValue = rightValue - (Math.ceil((this.actionObj.pageX - this.actionObj.X) / slotInterval) * slotInterval);
526
+ if (rightValue < 0) {
527
+ rightValue = parseInt(this.actionObj.clone.style.right, 10);
528
+ width = parseInt(this.actionObj.clone.style.width, 10);
529
+ }
523
530
  }
524
531
  rightValue = rightValue >= this.scrollArgs.width ? this.scrollArgs.width - this.actionObj.cellWidth : rightValue;
525
532
  styles.right = formatUnit(rightValue);
@@ -541,12 +548,19 @@ var Resize = /** @class */ (function (_super) {
541
548
  }
542
549
  }
543
550
  var leftValue = offsetLeft;
544
- offsetLeft = isTimelineView ? isTimeViews ? isLeft ? Math.floor(offsetLeft / slotInterval) * slotInterval : offsetLeft :
551
+ offsetLeft = isTimelineView ? isTimeViews ? isLeft ? this.actionObj.element.offsetLeft -
552
+ (Math.ceil((this.actionObj.element.offsetLeft - offsetLeft) / slotInterval) * slotInterval) : offsetLeft :
545
553
  Math.floor(offsetLeft / this.actionObj.cellWidth) * this.actionObj.cellWidth :
546
554
  Math.ceil(Math.abs(offsetLeft) / this.actionObj.cellWidth) * this.actionObj.cellWidth;
547
555
  if (offsetLeft < 0) {
548
- offsetLeft = 0;
549
- width = this.actionObj.clone.getBoundingClientRect().width;
556
+ if (isTimelineView && isLeft && (offsetLeft % slotInterval)) {
557
+ offsetLeft = parseInt(this.actionObj.clone.style.left, 10);
558
+ width = parseInt(this.actionObj.clone.style.width, 10);
559
+ }
560
+ else {
561
+ offsetLeft = 0;
562
+ width = this.actionObj.clone.getBoundingClientRect().width;
563
+ }
550
564
  }
551
565
  var cloneWidth = Math.ceil(this.actionObj.clone.getBoundingClientRect().width / this.actionObj.cellWidth) *
552
566
  this.actionObj.cellWidth;
@@ -89,6 +89,7 @@ export declare class EventBase {
89
89
  getPageCoordinates(e: MouseEvent & TouchEvent): (MouseEvent & TouchEvent) | Touch;
90
90
  renderSpannedIcon(element: HTMLElement, spanEvent: Record<string, any>): void;
91
91
  addCellHeight(selector: string, eventHeight: number, eventGap: number, headerHeight: number, indHeight: number, isScrollUpdate?: boolean): void;
92
+ getCellWidth(element: HTMLElement): number;
92
93
  private unWireEvents;
93
94
  destroy(): void;
94
95
  }
@@ -1354,6 +1354,9 @@ var EventBase = /** @class */ (function () {
1354
1354
  }
1355
1355
  }
1356
1356
  };
1357
+ EventBase.prototype.getCellWidth = function (element) {
1358
+ return document.body.style.transform.includes('scale') ? parseFloat(window.getComputedStyle(element).width) : element.getBoundingClientRect().width;
1359
+ };
1357
1360
  EventBase.prototype.unWireEvents = function () {
1358
1361
  var appElements = [].slice.call(this.parent.element.querySelectorAll('.' + cls.APPOINTMENT_CLASS));
1359
1362
  for (var _i = 0, appElements_1 = appElements; _i < appElements_1.length; _i++) {
@@ -174,10 +174,9 @@ var MonthEvent = /** @class */ (function (_super) {
174
174
  setStyleAttribute(cell, { 'height': height_1 + 'px' });
175
175
  });
176
176
  }
177
- var cellDetail = this.workCells[this.parent.activeView.isTimelineView() ?
178
- 0 : this.workCells.length - 1].getBoundingClientRect();
179
- this.cellWidth = cellDetail.width;
180
- this.cellHeight = cellDetail.height;
177
+ var cellDetail = this.workCells[this.parent.activeView.isTimelineView() ? 0 : this.workCells.length - 1];
178
+ this.cellWidth = this.parent.eventBase.getCellWidth(cellDetail);
179
+ this.cellHeight = cellDetail.getBoundingClientRect().height;
181
180
  this.dateRender = dateRender;
182
181
  var filteredDates = this.getRenderedDates(dateRender);
183
182
  this.getSlotDates(workDays || this.parent.activeViewOptions.workDays);
@@ -23,6 +23,7 @@ export declare class TimelineEvent extends MonthEvent {
23
23
  getOverlapSortComparerEvents(startDate: Date, endDate: Date, appointmentsCollection: Record<string, any>[]): Record<string, any>[];
24
24
  renderResourceEvents(): void;
25
25
  renderEvents(event: Record<string, any>, resIndex: number, appointmentsList?: Record<string, any>[]): void;
26
+ private adjustToNearestTimeSlot;
26
27
  private renderTimelineMoreIndicator;
27
28
  updateCellHeight(cell: HTMLElement, height: number): void;
28
29
  private adjustAppointments;
@@ -237,8 +237,11 @@ var TimelineEvent = /** @class */ (function (_super) {
237
237
  this.slotCount / this.interval;
238
238
  for (var k = 0; k < slotCount; k++) {
239
239
  startDate = (k === 0) ? new Date(startDate.getTime()) : new Date(startDate.getTime() + (60000 * interval));
240
+ if (slotCount < 1) {
241
+ startDate = this.adjustToNearestTimeSlot(startDate, interval);
242
+ }
240
243
  endDate = new Date(startDate.getTime() + (60000 * interval));
241
- if (endDate.getTime() > endTime.getTime()) {
244
+ if (slotCount >= 1 && endDate.getTime() > endTime.getTime()) {
242
245
  break;
243
246
  }
244
247
  var position_2 = this.getPosition(startDate, endDate, false, (this.day + i));
@@ -254,6 +257,20 @@ var TimelineEvent = /** @class */ (function (_super) {
254
257
  }
255
258
  this.parent.renderTemplates();
256
259
  };
260
+ TimelineEvent.prototype.adjustToNearestTimeSlot = function (inputTime, interval) {
261
+ // Parse the input time
262
+ var parsedTime = new Date(inputTime);
263
+ // Get the minutes of the input time in milliseconds
264
+ var minutesInMilliseconds = parsedTime.getHours() * 60 * 60 * 1000 + parsedTime.getMinutes() * 60 * 1000;
265
+ // Calculate the adjusted time in milliseconds (nearest time slot)
266
+ var adjustedMinutesInMilliseconds = Math.floor(minutesInMilliseconds / (interval * 60 * 1000)) * (interval * 60 * 1000);
267
+ // Create a new Date object with the adjusted time
268
+ var adjustedTime = new Date(parsedTime.getTime());
269
+ adjustedTime.setHours(adjustedMinutesInMilliseconds / (60 * 60 * 1000) % 24);
270
+ adjustedTime.setMinutes((adjustedMinutesInMilliseconds % (60 * 60 * 1000)) / (60 * 1000));
271
+ // Return the adjusted time in string format
272
+ return adjustedTime;
273
+ };
257
274
  TimelineEvent.prototype.renderTimelineMoreIndicator = function (startTime, startDate, endDate, appHeight, interval, resIndex, appointmentsList, top, appLeft, appRight, cellTd, moreIndicator, appPos, position) {
258
275
  appLeft = (this.parent.enableRtl) ? appRight = position : position;
259
276
  appPos = (this.parent.enableRtl) ? appRight : appLeft;
@@ -313,8 +330,9 @@ var TimelineEvent = /** @class */ (function (_super) {
313
330
  TimelineEvent.prototype.adjustAppointments = function (conWidth) {
314
331
  var _this = this;
315
332
  var tr = this.parent.element.querySelector('.' + cls.CONTENT_TABLE_CLASS + ' tbody tr');
316
- this.cellWidth = this.workCells[0].getBoundingClientRect().width;
317
- var currentPercentage = (this.cellWidth * tr.children.length) / (conWidth / 100);
333
+ var actualCellWidth = this.workCells[0].getBoundingClientRect().width;
334
+ this.cellWidth = actualCellWidth / +(this.workCells[0].getAttribute('colspan') || 1);
335
+ var currentPercentage = (actualCellWidth * tr.children.length) / (conWidth / 100);
318
336
  var apps = [].slice.call(this.parent.element.querySelectorAll('.' + cls.APPOINTMENT_CLASS));
319
337
  apps.forEach(function (app) {
320
338
  if (_this.parent.enableRtl && app.style.right !== '0px') {
@@ -89,7 +89,7 @@ var YearEvent = /** @class */ (function (_super) {
89
89
  YearEvent.prototype.timelineYearViewEvents = function () {
90
90
  var _this = this;
91
91
  var workCell = this.parent.element.querySelector('.' + cls.WORK_CELLS_CLASS + ':not(.' + cls.OTHERMONTH_CLASS + ')');
92
- this.cellWidth = workCell.getBoundingClientRect().width;
92
+ this.cellWidth = this.parent.eventBase.getCellWidth(workCell);
93
93
  this.cellHeader = util.getOuterHeight(workCell.querySelector('.' + cls.DATE_HEADER_CLASS));
94
94
  var eventTable = this.parent.element.querySelector('.' + cls.EVENT_TABLE_CLASS);
95
95
  this.eventHeight = util.getElementHeightFromClass(eventTable, cls.APPOINTMENT_CLASS);