@syncfusion/ej2-schedule 27.1.56 → 27.1.58

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 : 27.1.56
3
+ * version : 27.1.58
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@27.1.55",
3
+ "_id": "@syncfusion/ej2-schedule@27.1.57",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-5voLaihRI8Cl4b+vp/Krva3umpRr8awwCVvCMSofVIDvpD3N7qGisdFknBShYr1Ph7aJbysvOIT/uFPKqZNlHA==",
5
+ "_integrity": "sha512-Nfn3W+XeW1/wtDhCxCvFKCyD0gCRCyEPB3r/AoHB+Rb6RMRCt3JQvcnlZp66Eix1Dsnj1Nrigvqbe0YepHQKrw==",
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.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-schedule/-/ej2-schedule-27.1.55.tgz",
27
- "_shasum": "b024fa4861634b50578a28bb08c0dd1081c1cb26",
26
+ "_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-schedule/-/ej2-schedule-27.1.57.tgz",
27
+ "_shasum": "938ad7e4dc8096d9db5917e81a2bc31c61062e88",
28
28
  "_spec": "@syncfusion/ej2-schedule@*",
29
29
  "_where": "/jenkins/workspace/elease-automation_release_27.1.1/packages/included",
30
30
  "author": {
@@ -36,15 +36,15 @@
36
36
  "bundleDependencies": false,
37
37
  "dependencies": {
38
38
  "@syncfusion/ej2-base": "~27.1.55",
39
- "@syncfusion/ej2-buttons": "~27.1.53",
40
- "@syncfusion/ej2-calendars": "~27.1.55",
39
+ "@syncfusion/ej2-buttons": "~27.1.58",
40
+ "@syncfusion/ej2-calendars": "~27.1.57",
41
41
  "@syncfusion/ej2-data": "~27.1.52",
42
- "@syncfusion/ej2-dropdowns": "~27.1.55",
42
+ "@syncfusion/ej2-dropdowns": "~27.1.58",
43
43
  "@syncfusion/ej2-excel-export": "~27.1.50",
44
- "@syncfusion/ej2-inputs": "~27.1.55",
44
+ "@syncfusion/ej2-inputs": "~27.1.58",
45
45
  "@syncfusion/ej2-lists": "~27.1.50",
46
- "@syncfusion/ej2-navigations": "~27.1.56",
47
- "@syncfusion/ej2-popups": "~27.1.56"
46
+ "@syncfusion/ej2-navigations": "~27.1.58",
47
+ "@syncfusion/ej2-popups": "~27.1.58"
48
48
  },
49
49
  "deprecated": false,
50
50
  "description": "Flexible scheduling library with more built-in features and enhanced customization options similar to outlook and google calendar, allowing the users to plan and manage their appointments with efficient data-binding support.",
@@ -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": "27.1.56",
76
+ "version": "27.1.58",
77
77
  "sideEffects": false
78
78
  }
@@ -153,7 +153,7 @@ export function generate(startDate, rule, excludeDate, startDayOfWeek, maximumCo
153
153
  dailyType(modifiedDate, ruleObject.until, data, ruleObject);
154
154
  break;
155
155
  case 'WEEKLY':
156
- weeklyType(modifiedDate, ruleObject.until, data, ruleObject);
156
+ weeklyType(modifiedDate, ruleObject.until, data, ruleObject, startDayOfWeek);
157
157
  break;
158
158
  case 'MONTHLY':
159
159
  monthlyType(modifiedDate, ruleObject.until, data, ruleObject);
@@ -256,10 +256,11 @@ function dailyType(startDate, endDate, data, ruleObject) {
256
256
  * @param {Date} endDate Accepts the end date
257
257
  * @param {number[]} data Accepts the collection of dates
258
258
  * @param {RecRule} ruleObject Accepts the recurrence rule object
259
+ * @param {number} startDayOfWeek Accepts the start day index of week
259
260
  * @returns {void}
260
261
  * @private
261
262
  */
262
- function weeklyType(startDate, endDate, data, ruleObject) {
263
+ function weeklyType(startDate, endDate, data, ruleObject, startDayOfWeek) {
263
264
  var tempDate = new Date(startDate.getTime());
264
265
  if (!ruleObject.day.length) {
265
266
  ruleObject.day.push(DAYINDEX[startDate.getDay()]);
@@ -308,7 +309,7 @@ function weeklyType(startDate, endDate, data, ruleObject) {
308
309
  }
309
310
  else {
310
311
  tempDate = getStartDateForWeek(startDate, ruleObject.day);
311
- if (interval > 1 && dayIndex.indexOf(ruleObject.day[0]) < startDate.getDay()) {
312
+ if (interval > 1 && dayIndex.indexOf(ruleObject.day[0]) < (startDate.getDay() - startDayOfWeek)) {
312
313
  tempDate.setDate(tempDate.getDate() + ((interval - 1) * 7));
313
314
  }
314
315
  while (compareDates(tempDate, endDate)) {
@@ -42,6 +42,7 @@ export declare class EventBase {
42
42
  getSelectedAppointments(): Element[];
43
43
  focusElement(isFocused?: boolean): void;
44
44
  selectWorkCellByTime(eventsData: Record<string, any>[]): Element;
45
+ private findNearestSlot;
45
46
  getGroupIndexFromEvent(eventData: Record<string, any>): number;
46
47
  isAllDayAppointment(event: Record<string, any>): boolean;
47
48
  addEventListener(): void;
@@ -59,6 +60,7 @@ export declare class EventBase {
59
60
  getEventMaxID(resourceId?: number): number | string;
60
61
  private activeEventData;
61
62
  generateOccurrence(event: Record<string, any>, viewDate?: Date, isMaxCount?: boolean): Record<string, any>[];
63
+ private isDayBasedRecurrence;
62
64
  private getDSTAdjustedTime;
63
65
  private getDSTDiff;
64
66
  getParentEvent(eventObj: Record<string, any>, isParent?: boolean): Record<string, any>;
@@ -584,11 +584,14 @@ var EventBase = /** @class */ (function () {
584
584
  if (eventsData.length > 0) {
585
585
  var selectedObject = eventsData[eventsData.length - 1];
586
586
  var eventStartTime = selectedObject[this.parent.eventFields.startTime];
587
- var nearestTime = new Date(+eventStartTime).setMinutes(0, 0, 0);
587
+ var nearestTime = void 0;
588
588
  var isAllDay = this.isAllDayAppointment(selectedObject);
589
- if (this.parent.currentView === 'Month' || isAllDay) {
589
+ if (this.parent.currentView === 'Month' || isAllDay || !this.parent.activeViewOptions.timeScale.enable) {
590
590
  nearestTime = new Date(+eventStartTime).setHours(0, 0, 0, 0);
591
591
  }
592
+ else {
593
+ nearestTime = this.findNearestSlot(eventStartTime);
594
+ }
592
595
  var targetArea = void 0;
593
596
  if (isAllDay && ['Day', 'Week', 'WorkWeek'].indexOf(this.parent.currentView) !== -1) {
594
597
  targetArea = this.parent.getAllDayRow();
@@ -597,7 +600,8 @@ var EventBase = /** @class */ (function () {
597
600
  targetArea = this.parent.getContentTable();
598
601
  }
599
602
  var queryString = '[data-date="' + new Date(nearestTime).getTime() + '"]';
600
- if (this.parent.activeViewOptions.group.resources.length > 0) {
603
+ if (!isNullOrUndefined(this.parent.activeViewOptions.group.resources) &&
604
+ this.parent.activeViewOptions.group.resources.length > 0) {
601
605
  queryString += '[data-group-index="' + this.getGroupIndexFromEvent(selectedObject) + '"]';
602
606
  }
603
607
  target = targetArea.querySelector(queryString);
@@ -611,6 +615,25 @@ var EventBase = /** @class */ (function () {
611
615
  }
612
616
  return target;
613
617
  };
618
+ EventBase.prototype.findNearestSlot = function (appointmentTime) {
619
+ var msMajorInterval = this.parent.activeViewOptions.timeScale.interval * util.MS_PER_MINUTE;
620
+ var msInterval = msMajorInterval / this.parent.activeViewOptions.timeScale.slotCount;
621
+ var numberOfSlots = Math.round(util.MS_PER_DAY / msInterval);
622
+ var startTime = new Date(appointmentTime);
623
+ startTime.setHours(0, 0, 0, 0);
624
+ var slots = Array.from({ length: numberOfSlots }, function (_, i) {
625
+ var slotTime = new Date(startTime.getTime() + i * msInterval);
626
+ return slotTime;
627
+ });
628
+ var nearestSlot = slots.reduce(function (nearest, slot) {
629
+ var difference = Math.abs(appointmentTime.getTime() - slot.getTime());
630
+ if (!nearest || difference < Math.abs(appointmentTime.getTime() - nearest.getTime())) {
631
+ return slot;
632
+ }
633
+ return nearest;
634
+ }, null);
635
+ return Math.trunc(nearestSlot.getTime() / 1000) * 1000;
636
+ };
614
637
  EventBase.prototype.getGroupIndexFromEvent = function (eventData) {
615
638
  var levelIndex;
616
639
  var resource;
@@ -912,7 +935,7 @@ var EventBase = /** @class */ (function () {
912
935
  var newTimezone = this.parent.timezone || this.parent.tzModule.getLocalTimezoneName();
913
936
  var firstDay = this.parent.activeViewOptions.firstDayOfWeek;
914
937
  var calendarMode = this.parent.calendarMode;
915
- if (event[this.parent.eventFields.recurrenceRule] && event[this.parent.eventFields.recurrenceRule].includes('BYMONTHDAY') &&
938
+ if (event[this.parent.eventFields.recurrenceRule] && this.isDayBasedRecurrence(event) &&
916
939
  this.parent.timezone && event[this.parent.eventFields.startTimezone] && event[this.parent.eventFields.endTimezone]) {
917
940
  startDate = this.parent.tzModule.convert(event[this.parent.eventFields.startTime], this.parent.timezone, event[this.parent.eventFields.startTimezone]);
918
941
  }
@@ -932,7 +955,7 @@ var EventBase = /** @class */ (function () {
932
955
  }
933
956
  var isDSTAdjusted = false;
934
957
  var convertedDates = [];
935
- if (event[this.parent.eventFields.recurrenceRule] && event[this.parent.eventFields.recurrenceRule].includes('BYMONTHDAY') &&
958
+ if (event[this.parent.eventFields.recurrenceRule] && this.isDayBasedRecurrence(event) &&
936
959
  this.parent.timezone && event[this.parent.eventFields.startTimezone] && event[this.parent.eventFields.endTimezone]) {
937
960
  isDSTAdjusted = true;
938
961
  convertedDates.push.apply(convertedDates, dates.map(function (date) {
@@ -955,6 +978,10 @@ var EventBase = /** @class */ (function () {
955
978
  }
956
979
  return occurrenceCollection;
957
980
  };
981
+ EventBase.prototype.isDayBasedRecurrence = function (event) {
982
+ return (event[this.parent.eventFields.recurrenceRule].includes('BYMONTHDAY')
983
+ || event[this.parent.eventFields.recurrenceRule].includes('BYDAY'));
984
+ };
958
985
  EventBase.prototype.getDSTAdjustedTime = function (date, event) {
959
986
  var occurDate = date;
960
987
  if (this.parent.timezone &&
@@ -169,10 +169,12 @@ var Print = /** @class */ (function () {
169
169
  var _this = this;
170
170
  this.printWindow = basePrint(this.printInstance.element, this.printWindow);
171
171
  this.printWindow.onbeforeunload = function () {
172
- _this.printInstance.off(events.print, _this.contentReady);
173
- _this.printInstance.element.remove();
174
- _this.printInstance.destroy();
175
- _this.printInstance = null;
172
+ if (_this.printInstance) {
173
+ _this.printInstance.off(events.print, _this.contentReady);
174
+ _this.printInstance.element.remove();
175
+ _this.printInstance.destroy();
176
+ _this.printInstance = null;
177
+ }
176
178
  _this.printWindow = null;
177
179
  };
178
180
  };