@syncfusion/ej2-schedule 22.2.11 → 22.2.12

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.
@@ -389,6 +389,7 @@ function getScrollBarWidth() {
389
389
  * Method to reset scrollbar width
390
390
  *
391
391
  * @private
392
+ * @returns {void}
392
393
  */
393
394
  function resetScrollbarWidth() {
394
395
  var zoomPixelRatio = window.devicePixelRatio || window.screen.availWidth / document.documentElement.clientWidth;
@@ -2073,6 +2074,11 @@ var KeyboardInteraction = /** @__PURE__ @class */ (function () {
2073
2074
  }
2074
2075
  var queryStr = '.' + WORK_CELLS_CLASS + ',.' + ALLDAY_CELLS_CLASS + ',.' + HEADER_CELLS_CLASS;
2075
2076
  var target = closest(e.target, queryStr);
2077
+ var selectedCells = this.parent.getSelectedCells();
2078
+ if (this.parent.activeViewOptions.group.resources.length > 0 && selectedCells.length > 0 &&
2079
+ selectedCells[0].getAttribute('data-group-index') !== target.getAttribute('data-group-index')) {
2080
+ target = selectedCells[selectedCells.length - 1];
2081
+ }
2076
2082
  if (this.parent.currentView === 'TimelineYear' && target.classList.contains(OTHERMONTH_CLASS)) {
2077
2083
  return;
2078
2084
  }
@@ -2081,7 +2087,6 @@ var KeyboardInteraction = /** @__PURE__ @class */ (function () {
2081
2087
  if (this.parent.eventWindow) {
2082
2088
  this.parent.eventWindow.convertToEventData(this.parent.activeCellsData, cellData);
2083
2089
  }
2084
- var selectedCells = this.parent.getSelectedCells();
2085
2090
  var args = {
2086
2091
  data: cellData, element: this.parent.activeCellsData.element, event: e,
2087
2092
  requestType: cellSelect, showQuickPopup: false
@@ -3738,15 +3743,13 @@ function getMonthSummary(ruleObject, cldrObj, localeObj) {
3738
3743
  * @param {number} maximumCount Accepts the maximum number count to generate date collections
3739
3744
  * @param {Date} viewDate Accepts the current date instead of start date
3740
3745
  * @param {CalendarType} calendarMode Accepts the calendar type
3741
- * @param {string} oldTimezone Accepts the timezone name
3742
3746
  * @param {string} newTimezone Accepts the timezone name
3743
3747
  * @returns {number[]} Returns the collection of dates
3744
3748
  */
3745
- function generate(startDate, rule, excludeDate, startDayOfWeek, maximumCount, viewDate, calendarMode, oldTimezone, newTimezone) {
3749
+ function generate(startDate, rule, excludeDate, startDayOfWeek, maximumCount, viewDate, calendarMode, newTimezone) {
3746
3750
  if (maximumCount === void 0) { maximumCount = MAXOCCURRENCE; }
3747
3751
  if (viewDate === void 0) { viewDate = null; }
3748
3752
  if (calendarMode === void 0) { calendarMode = 'Gregorian'; }
3749
- if (oldTimezone === void 0) { oldTimezone = null; }
3750
3753
  if (newTimezone === void 0) { newTimezone = null; }
3751
3754
  var ruleObject = extractObjectFromRule(rule);
3752
3755
  var cacheDate;
@@ -3758,8 +3761,8 @@ function generate(startDate, rule, excludeDate, startDayOfWeek, maximumCount, vi
3758
3761
  var tz = new Timezone();
3759
3762
  tempDate.forEach(function (content) {
3760
3763
  var parsedDate = getDateFromRecurrenceDateString(content);
3761
- if (oldTimezone && newTimezone) {
3762
- parsedDate = tz.convert(new Date(parsedDate.getTime()), oldTimezone, newTimezone);
3764
+ if (newTimezone) {
3765
+ parsedDate = tz.add(new Date(parsedDate.getTime()), newTimezone);
3763
3766
  }
3764
3767
  tempExcludeDate.push(new Date(parsedDate.getTime()).setHours(0, 0, 0, 0));
3765
3768
  });
@@ -5318,12 +5321,12 @@ var EventBase = /** @__PURE__ @class */ (function () {
5318
5321
  }
5319
5322
  if (!isNullOrUndefined(event_1[fields.recurrenceRule]) && isNullOrUndefined(event_1[fields.recurrenceID]) &&
5320
5323
  !(this_1.parent.crudModule && this_1.parent.crudModule.crudObj.isCrudAction)) {
5321
- processed = processed.concat(this_1.generateOccurrence(event_1, null, oldTimezone, true));
5324
+ processed = processed.concat(this_1.generateOccurrence(event_1, null, true));
5322
5325
  }
5323
5326
  else {
5324
5327
  if (this_1.parent.crudModule && this_1.parent.crudModule.crudObj.isCrudAction) {
5325
5328
  if (!isNullOrUndefined(event_1[fields.recurrenceRule]) && isNullOrUndefined(event_1[fields.recurrenceID])) {
5326
- var recurrenceEvent = this_1.generateOccurrence(event_1, null, oldTimezone, true);
5329
+ var recurrenceEvent = this_1.generateOccurrence(event_1, null, true);
5327
5330
  var _loop_2 = function (occurrence) {
5328
5331
  var app = this_1.parent.eventsProcessed.filter(function (data) {
5329
5332
  return data[fields.startTime].getTime() - occurrence[fields.startTime].getTime() === 0 &&
@@ -6143,7 +6146,7 @@ var EventBase = /** @__PURE__ @class */ (function () {
6143
6146
  }
6144
6147
  this.parent.activeEventData = { event: eventObject, element: target };
6145
6148
  };
6146
- EventBase.prototype.generateOccurrence = function (event, viewDate, oldTimezone, isMaxCount) {
6149
+ EventBase.prototype.generateOccurrence = function (event, viewDate, isMaxCount) {
6147
6150
  var startDate = event[this.parent.eventFields.startTime];
6148
6151
  var endDate = event[this.parent.eventFields.endTime];
6149
6152
  var eventRule = event[this.parent.eventFields.recurrenceRule];
@@ -6158,7 +6161,7 @@ var EventBase = /** @__PURE__ @class */ (function () {
6158
6161
  var newTimezone = this.parent.timezone || this.parent.tzModule.getLocalTimezoneName();
6159
6162
  var firstDay = this.parent.activeViewOptions.firstDayOfWeek;
6160
6163
  var calendarMode = this.parent.calendarMode;
6161
- var dates = generate(startDate, eventRule, exception, firstDay, maxCount, viewDate, calendarMode, oldTimezone, newTimezone);
6164
+ var dates = generate(startDate, eventRule, exception, firstDay, maxCount, viewDate, calendarMode, newTimezone);
6162
6165
  if (this.parent.currentView === 'Agenda' && eventRule.indexOf('COUNT') === -1 && eventRule.indexOf('UNTIL') === -1) {
6163
6166
  if (isNullOrUndefined(event.generatedDates)) {
6164
6167
  event.generatedDates = { start: new Date(dates[0]), end: new Date(dates[dates.length - 1]) };
@@ -14681,7 +14684,8 @@ var Crud = /** @__PURE__ @class */ (function () {
14681
14684
  }
14682
14685
  var updateEvents = (eventData instanceof Array) ? eventData : [eventData];
14683
14686
  var args = {
14684
- requestType: action === 'EditOccurrence' ? 'eventChange' : 'eventRemove', cancel: false,
14687
+ requestType: action === 'EditOccurrence' ? 'eventChange' : 'eventRemove',
14688
+ cancel: false,
14685
14689
  addedRecords: [], changedRecords: updateEvents, deletedRecords: []
14686
14690
  };
14687
14691
  args.data = occurrenceData;
@@ -14992,6 +14996,10 @@ var Crud = /** @__PURE__ @class */ (function () {
14992
14996
  return parentEvent;
14993
14997
  };
14994
14998
  Crud.prototype.excludeDateCheck = function (eventStartTime, exceptionDateList) {
14999
+ var timezone = this.parent.timezone || this.parent.tzModule.getLocalTimezoneName();
15000
+ if (timezone) {
15001
+ eventStartTime = this.parent.tzModule.remove(new Date(+eventStartTime.getTime()), timezone);
15002
+ }
14995
15003
  var exDate = getRecurrenceStringFromDate(eventStartTime);
14996
15004
  if (!isNullOrUndefined(exceptionDateList)) {
14997
15005
  if (exceptionDateList.indexOf(exDate) === -1) {
@@ -26566,8 +26574,11 @@ var TimelineViews = /** @__PURE__ @class */ (function (_super) {
26566
26574
  var diffInMinutes = ((date.getHours() - startHour.getHours()) * 60) + (date.getMinutes() - startHour.getMinutes());
26567
26575
  if (!isNullOrUndefined(currentDateIndex)) {
26568
26576
  if (currentDateIndex[0] !== 0) {
26569
- if (this.parent.activeView.colLevels[0] && this.parent.activeView.colLevels[0][0].colSpan) {
26570
- diffInDates = currentDateIndex[0] * this.parent.activeView.colLevels[0][0].colSpan * this.getWorkCellWidth();
26577
+ var index = this.parent.activeView.colLevels.findIndex(function (level) { return level[0].type === 'dateHeader'; });
26578
+ if (this.parent.activeView.colLevels[parseInt(index.toString(), 10)] &&
26579
+ this.parent.activeView.colLevels[parseInt(index.toString(), 10)][0].colSpan) {
26580
+ diffInDates = currentDateIndex[0] * this.parent.activeView.colLevels[parseInt(index.toString(), 10)][0].colSpan *
26581
+ this.getWorkCellWidth();
26571
26582
  }
26572
26583
  else {
26573
26584
  var endHour = this.getEndHour();
@@ -27511,116 +27522,144 @@ var ICalendarImport = /** @__PURE__ @class */ (function () {
27511
27522
  }
27512
27523
  };
27513
27524
  ICalendarImport.prototype.iCalendarParser = function (iCalString) {
27514
- var _this = this;
27515
- var fields = this.parent.eventFields;
27516
- var events = [];
27517
- var uId = 'UID';
27518
- var calArray = iCalString.replace(new RegExp('\\r', 'g'), '').split('\n');
27519
- var descriptionIndex = calArray.findIndex(function (line) { return line.startsWith('DESCRIPTION:'); });
27520
- if (descriptionIndex !== -1) {
27521
- var description = calArray[descriptionIndex].substring('DESCRIPTION:'.length);
27522
- for (var i = descriptionIndex + 1; i < calArray.length; i++) {
27523
- if (calArray[i].startsWith(' ') || !(/[A-Z]{3}:/.test(calArray[i]))) {
27524
- description += calArray[i];
27525
- }
27526
- else {
27527
- calArray[descriptionIndex] = 'DESCRIPTION:' + description;
27528
- break;
27525
+ var iCalData = {
27526
+ isEvent: false,
27527
+ curEvent: null,
27528
+ id: this.parent.eventBase.getEventMaxID(),
27529
+ count: 0,
27530
+ events: [],
27531
+ key: null
27532
+ };
27533
+ var iStringLength = iCalString.length;
27534
+ var lastPosition = iCalString.search(/[^ \t]/);
27535
+ var position = lastPosition;
27536
+ var iString;
27537
+ var newlineOffset;
27538
+ do {
27539
+ position = iCalString.indexOf('\n', lastPosition) + 1;
27540
+ if (position === 0) {
27541
+ position = iStringLength;
27542
+ newlineOffset = 0;
27543
+ }
27544
+ else if (position > 1 && iCalString[position - 2] === '\r') {
27545
+ newlineOffset = 2;
27546
+ }
27547
+ else {
27548
+ newlineOffset = 1;
27549
+ }
27550
+ // eslint-disable-next-line security/detect-object-injection
27551
+ var firstChar = iCalString[lastPosition];
27552
+ if (firstChar === ' ' || firstChar === '\n' || firstChar === '\t') {
27553
+ iString += iCalString.slice(lastPosition + 1, position - newlineOffset);
27554
+ }
27555
+ else {
27556
+ if (iString) {
27557
+ iCalData = this.updateEventData(iString, iCalData);
27529
27558
  }
27559
+ iString = iCalString.slice(lastPosition, position - newlineOffset);
27530
27560
  }
27561
+ lastPosition = position;
27562
+ } while (position !== iStringLength);
27563
+ iString = iString.trim();
27564
+ if (iString.length) {
27565
+ iCalData = this.updateEventData(iString, iCalData);
27531
27566
  }
27532
- var isEvent = false;
27533
- var curEvent;
27534
- // eslint-disable-next-line prefer-const
27535
- var id = this.parent.eventBase.getEventMaxID();
27536
- var count = 0;
27537
- calArray.forEach(function (element) {
27538
- var index;
27539
- var type;
27540
- var value;
27541
- if (!isEvent && element === 'BEGIN:VEVENT') {
27542
- isEvent = true;
27543
- curEvent = {};
27544
- }
27545
- if (isEvent && element === 'END:VEVENT') {
27546
- isEvent = false;
27547
- events.push(curEvent);
27548
- curEvent = null;
27549
- }
27550
- if (isEvent) {
27551
- index = element.indexOf(':');
27552
- type = element.substr(0, index).replace(/^\s\s*/, '').replace(/\s\s*$/, '');
27553
- value = element.substr(index + 1, element.length - (index + 1)).replace(/^\s\s*/, '').replace(/\s\s*$/, '');
27554
- if (element.indexOf('SUMMARY') !== -1) {
27555
- type = 'SUMMARY';
27556
- }
27557
- if (element.indexOf('DTSTART') !== -1) {
27558
- curEvent[fields.startTime] = _this.dateParsing(element);
27559
- curEvent[fields.isAllDay] = _this.allDay;
27560
- _this.allDay = false;
27561
- }
27562
- else if (element.indexOf('DTEND') !== -1) {
27563
- curEvent[fields.endTime] = _this.dateParsing(element);
27564
- }
27565
- else if (element.indexOf('EXDATE') !== -1) {
27566
- value = getRecurrenceStringFromDate(_this.dateParsing(element));
27567
- curEvent[fields.recurrenceException] = (isNullOrUndefined(curEvent[fields.recurrenceException])) ?
27568
- value : curEvent[fields.recurrenceException] + ',' + value;
27569
- }
27570
- else if (element.indexOf('RECURRENCE-ID') !== -1) {
27571
- value = getRecurrenceStringFromDate(_this.dateParsing(element));
27572
- curEvent[fields.recurrenceException] = value;
27573
- curEvent[fields.recurrenceID] = value;
27574
- }
27575
- else {
27576
- switch (type) {
27577
- case 'BEGIN':
27578
- break;
27579
- case 'UID':
27580
- curEvent["" + uId] = value;
27581
- if (typeof (id) == 'number') {
27582
- curEvent[fields.id] = parseInt(value, 10);
27583
- if (isNaN(curEvent[fields.id])) {
27584
- curEvent[fields.id] = id + count;
27585
- count++;
27586
- }
27587
- }
27588
- else {
27589
- curEvent[fields.id] = value;
27590
- }
27591
- break;
27592
- case 'SUMMARY':
27593
- curEvent[fields.subject] = value;
27594
- break;
27595
- case 'LOCATION':
27596
- curEvent[fields.location] = value;
27597
- break;
27598
- case 'DESCRIPTION':
27599
- if (!(curEvent[fields.description])) {
27600
- curEvent[fields.description] = value.replace(/\\,/g, ',')
27601
- .replace(/\\n/g, '\n');
27602
- }
27603
- break;
27604
- case 'ISREADONLY':
27605
- curEvent[fields.isReadonly] = (value.indexOf('true') > -1);
27606
- break;
27607
- case 'RRULE':
27608
- curEvent[fields.recurrenceRule] = value;
27609
- break;
27610
- default:
27611
- if (_this.parent.resourceCollection.length > 0) {
27612
- var resData = _this.parent.resourceCollection.filter(function (data) { return data.field === type; });
27613
- curEvent["" + type] = (resData.length > 0 && (typeof (resData[0].dataSource[0][resData[0].idField]) == 'number')) ? parseInt(value, 10) : value;
27614
- }
27615
- else {
27616
- curEvent["" + type] = value;
27567
+ var app = extend([], iCalData.events, null, true);
27568
+ this.parent.addEvent(this.processOccurrence(app, iCalData.id));
27569
+ };
27570
+ ICalendarImport.prototype.updateEventData = function (iString, iCalData) {
27571
+ var fields = this.parent.eventFields;
27572
+ var SEPARATOR = '\r\n';
27573
+ var id = iCalData.id;
27574
+ var events = iCalData.events;
27575
+ var isEvent = iCalData.isEvent;
27576
+ var count = iCalData.count;
27577
+ var curEvent = iCalData.curEvent;
27578
+ var key = iCalData.key;
27579
+ if (!isEvent && iString === 'BEGIN:VEVENT') {
27580
+ isEvent = true;
27581
+ curEvent = {};
27582
+ }
27583
+ if (isEvent && iString === 'END:VEVENT') {
27584
+ isEvent = false;
27585
+ events.push(curEvent);
27586
+ curEvent = null;
27587
+ }
27588
+ if (isEvent) {
27589
+ var index = iString.indexOf(':');
27590
+ var type_1 = iString.substring(0, index).replace(/^\s\s*/, '').replace(/\s\s*$/, '');
27591
+ var value = iString.substring(index + 1, iString.length).replace(/^\s\s*/, '').replace(/\s\s*$/, '');
27592
+ if (iString.indexOf('SUMMARY') !== -1) {
27593
+ type_1 = 'SUMMARY';
27594
+ }
27595
+ if (iString.indexOf('DTSTART') !== -1) {
27596
+ curEvent[fields.startTime] = this.dateParsing(iString);
27597
+ curEvent[fields.isAllDay] = this.allDay;
27598
+ this.allDay = false;
27599
+ }
27600
+ else if (iString.indexOf('DTEND') !== -1) {
27601
+ curEvent[fields.endTime] = this.dateParsing(iString);
27602
+ }
27603
+ else if (iString.indexOf('EXDATE') !== -1) {
27604
+ value = getRecurrenceStringFromDate(this.dateParsing(iString));
27605
+ curEvent[fields.recurrenceException] = isNullOrUndefined(curEvent[fields.recurrenceException]) ?
27606
+ value : curEvent[fields.recurrenceException] + ',' + value;
27607
+ }
27608
+ else if (iString.indexOf('RECURRENCE-ID') !== -1) {
27609
+ value = getRecurrenceStringFromDate(this.dateParsing(iString));
27610
+ curEvent[fields.recurrenceException] = value;
27611
+ curEvent[fields.recurrenceID] = value;
27612
+ }
27613
+ else {
27614
+ key = type_1 || key;
27615
+ switch (key) {
27616
+ case 'BEGIN':
27617
+ break;
27618
+ case 'UID':
27619
+ curEvent["" + type_1] = value;
27620
+ if (typeof (id) == 'number') {
27621
+ curEvent[fields.id] = parseInt(value, 10);
27622
+ if (isNaN(curEvent[fields.id])) {
27623
+ curEvent[fields.id] = id + count;
27624
+ count++;
27617
27625
  }
27618
- }
27626
+ }
27627
+ else {
27628
+ curEvent[fields.id] = value;
27629
+ }
27630
+ break;
27631
+ case 'SUMMARY':
27632
+ curEvent[fields.subject] = this.getFormattedString(value);
27633
+ break;
27634
+ case 'LOCATION':
27635
+ curEvent[fields.location] = this.getFormattedString(value);
27636
+ break;
27637
+ case 'DESCRIPTION':
27638
+ if (curEvent[fields.description]) {
27639
+ curEvent[fields.description] = this.getFormattedString(curEvent[fields.description] + SEPARATOR + value);
27640
+ }
27641
+ else {
27642
+ curEvent[fields.description] = this.getFormattedString(value);
27643
+ }
27644
+ break;
27645
+ case 'ISREADONLY':
27646
+ curEvent[fields.isReadonly] = (value.indexOf('true') > -1);
27647
+ break;
27648
+ case 'RRULE':
27649
+ curEvent[fields.recurrenceRule] = value;
27650
+ break;
27651
+ default:
27652
+ if (this.parent.resourceCollection.length > 0) {
27653
+ var resData = this.parent.resourceCollection.filter(function (data) { return data.field === type_1; });
27654
+ curEvent["" + type_1] = (resData.length > 0 && (typeof (resData[0].dataSource[0][resData[0].idField]) == 'number')) ? parseInt(value, 10) : value;
27655
+ }
27656
+ else {
27657
+ curEvent["" + type_1] = value;
27658
+ }
27619
27659
  }
27620
27660
  }
27621
- });
27622
- var app = extend([], events, null, true);
27623
- this.parent.addEvent(this.processOccurrence(app, id));
27661
+ }
27662
+ return { isEvent: isEvent, curEvent: curEvent, id: id, count: count, events: events, key: key };
27624
27663
  };
27625
27664
  ICalendarImport.prototype.processOccurrence = function (app, maxId) {
27626
27665
  var _this = this;
@@ -27685,7 +27724,7 @@ var ICalendarImport = /** @__PURE__ @class */ (function () {
27685
27724
  }
27686
27725
  return parentException + ',' + occurrenceException;
27687
27726
  };
27688
- ICalendarImport.prototype.getDateString = function (value) {
27727
+ ICalendarImport.prototype.getFormattedString = function (value) {
27689
27728
  value = value || '';
27690
27729
  // eslint-disable-next-line no-useless-escape
27691
27730
  return (value.replace(/\\\,/g, ',').replace(/\\\;/g, ';').replace(/\\[nN]/g, '\n').replace(/\\\\/g, '\\'));
@@ -27693,7 +27732,7 @@ var ICalendarImport = /** @__PURE__ @class */ (function () {
27693
27732
  ICalendarImport.prototype.dateParsing = function (element) {
27694
27733
  var split = element.split(':');
27695
27734
  var value = split[split.length - 1];
27696
- var newDate = new Date(this.getDateString(value));
27735
+ var newDate = new Date(this.getFormattedString(value));
27697
27736
  if (element && (element.indexOf('VALUE=DATE') > -1 || element.indexOf('RECURRENCE-ID;TZID') > -1)) {
27698
27737
  var data_1 = /^(\d{4})(\d{2})(\d{2})$/.exec(value);
27699
27738
  if (data_1 !== null) {