@syncfusion/ej2-schedule 22.2.8 → 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]) };
@@ -9088,7 +9091,7 @@ var QuickPopups = /** @__PURE__ @class */ (function () {
9088
9091
  this.renderQuickDialog();
9089
9092
  };
9090
9093
  QuickPopups.prototype.renderQuickPopup = function () {
9091
- var quickPopupWrapper = createElement('div', { className: POPUP_WRAPPER_CLASS + ' e-popup-close' });
9094
+ var quickPopupWrapper = createElement('div', { className: POPUP_WRAPPER_CLASS + ' e-popup-close', attrs: { role: 'dialog' } });
9092
9095
  if (this.parent.isAdaptive) {
9093
9096
  document.body.appendChild(quickPopupWrapper);
9094
9097
  addClass([quickPopupWrapper], DEVICE_CLASS);
@@ -9511,6 +9514,7 @@ var QuickPopups = /** @__PURE__ @class */ (function () {
9511
9514
  quickCellPopup.appendChild(this.getPopupHeader('Cell', temp));
9512
9515
  quickCellPopup.appendChild(this.getPopupContent('Cell', args, temp));
9513
9516
  quickCellPopup.appendChild(this.getPopupFooter('Cell', temp));
9517
+ this.quickPopup.element.setAttribute('aria-label', this.l10n.getConstant('newEvent'));
9514
9518
  var subjectElement = quickCellPopup.querySelector('.' + SUBJECT_CLASS);
9515
9519
  if (subjectElement) {
9516
9520
  Input.createInput({ element: subjectElement, properties: { placeholder: this.l10n.getConstant('addTitle') } });
@@ -9582,6 +9586,7 @@ var QuickPopups = /** @__PURE__ @class */ (function () {
9582
9586
  quickEventPopup.appendChild(this.getPopupHeader('Event', eventData));
9583
9587
  quickEventPopup.appendChild(this.getPopupContent('Event', events, eventData));
9584
9588
  quickEventPopup.appendChild(this.getPopupFooter('Event', eventData));
9589
+ this.quickPopup.element.setAttribute('aria-label', this.l10n.getConstant('editEvent'));
9585
9590
  var readonly = this.parent.activeViewOptions.readonly || eventData[this.parent.eventFields.isReadonly];
9586
9591
  var editAction = !this.parent.eventSettings.allowEditing || readonly;
9587
9592
  var deleteAction = !this.parent.eventSettings.allowDeleting || readonly;
@@ -14679,7 +14684,8 @@ var Crud = /** @__PURE__ @class */ (function () {
14679
14684
  }
14680
14685
  var updateEvents = (eventData instanceof Array) ? eventData : [eventData];
14681
14686
  var args = {
14682
- requestType: action === 'EditOccurrence' ? 'eventChange' : 'eventRemove', cancel: false,
14687
+ requestType: action === 'EditOccurrence' ? 'eventChange' : 'eventRemove',
14688
+ cancel: false,
14683
14689
  addedRecords: [], changedRecords: updateEvents, deletedRecords: []
14684
14690
  };
14685
14691
  args.data = occurrenceData;
@@ -14990,6 +14996,10 @@ var Crud = /** @__PURE__ @class */ (function () {
14990
14996
  return parentEvent;
14991
14997
  };
14992
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
+ }
14993
15003
  var exDate = getRecurrenceStringFromDate(eventStartTime);
14994
15004
  if (!isNullOrUndefined(exceptionDateList)) {
14995
15005
  if (exceptionDateList.indexOf(exDate) === -1) {
@@ -26564,8 +26574,11 @@ var TimelineViews = /** @__PURE__ @class */ (function (_super) {
26564
26574
  var diffInMinutes = ((date.getHours() - startHour.getHours()) * 60) + (date.getMinutes() - startHour.getMinutes());
26565
26575
  if (!isNullOrUndefined(currentDateIndex)) {
26566
26576
  if (currentDateIndex[0] !== 0) {
26567
- if (this.parent.activeView.colLevels[0] && this.parent.activeView.colLevels[0][0].colSpan) {
26568
- 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();
26569
26582
  }
26570
26583
  else {
26571
26584
  var endHour = this.getEndHour();
@@ -27509,100 +27522,144 @@ var ICalendarImport = /** @__PURE__ @class */ (function () {
27509
27522
  }
27510
27523
  };
27511
27524
  ICalendarImport.prototype.iCalendarParser = function (iCalString) {
27512
- var _this = this;
27513
- var fields = this.parent.eventFields;
27514
- var events = [];
27515
- var uId = 'UID';
27516
- var calArray = iCalString.replace(new RegExp('\\r', 'g'), '').split('\n');
27517
- var isEvent = false;
27518
- var curEvent;
27519
- // eslint-disable-next-line prefer-const
27520
- var id = this.parent.eventBase.getEventMaxID();
27521
- var count = 0;
27522
- calArray.forEach(function (element) {
27523
- var index;
27524
- var type;
27525
- var value;
27526
- if (!isEvent && element === 'BEGIN:VEVENT') {
27527
- isEvent = true;
27528
- curEvent = {};
27529
- }
27530
- if (isEvent && element === 'END:VEVENT') {
27531
- isEvent = false;
27532
- events.push(curEvent);
27533
- curEvent = null;
27534
- }
27535
- if (isEvent) {
27536
- index = element.indexOf(':');
27537
- type = element.substr(0, index).replace(/^\s\s*/, '').replace(/\s\s*$/, '');
27538
- value = element.substr(index + 1, element.length - (index + 1)).replace(/^\s\s*/, '').replace(/\s\s*$/, '');
27539
- if (element.indexOf('SUMMARY') !== -1) {
27540
- type = 'SUMMARY';
27541
- }
27542
- if (element.indexOf('DTSTART') !== -1) {
27543
- curEvent[fields.startTime] = _this.dateParsing(element);
27544
- curEvent[fields.isAllDay] = _this.allDay;
27545
- _this.allDay = false;
27546
- }
27547
- else if (element.indexOf('DTEND') !== -1) {
27548
- curEvent[fields.endTime] = _this.dateParsing(element);
27549
- }
27550
- else if (element.indexOf('EXDATE') !== -1) {
27551
- value = getRecurrenceStringFromDate(_this.dateParsing(element));
27552
- curEvent[fields.recurrenceException] = (isNullOrUndefined(curEvent[fields.recurrenceException])) ?
27553
- value : curEvent[fields.recurrenceException] + ',' + value;
27554
- }
27555
- else if (element.indexOf('RECURRENCE-ID') !== -1) {
27556
- value = getRecurrenceStringFromDate(_this.dateParsing(element));
27557
- curEvent[fields.recurrenceException] = value;
27558
- curEvent[fields.recurrenceID] = value;
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);
27559
27558
  }
27560
- else {
27561
- switch (type) {
27562
- case 'BEGIN':
27563
- break;
27564
- case 'UID':
27565
- curEvent["" + uId] = value;
27566
- if (typeof (id) == 'number') {
27567
- curEvent[fields.id] = parseInt(value, 10);
27568
- if (isNaN(curEvent[fields.id])) {
27569
- curEvent[fields.id] = id + count;
27570
- count++;
27571
- }
27572
- }
27573
- else {
27574
- curEvent[fields.id] = value;
27575
- }
27576
- break;
27577
- case 'SUMMARY':
27578
- curEvent[fields.subject] = value;
27579
- break;
27580
- case 'LOCATION':
27581
- curEvent[fields.location] = value;
27582
- break;
27583
- case 'DESCRIPTION':
27584
- curEvent[fields.description] = value;
27585
- break;
27586
- case 'ISREADONLY':
27587
- curEvent[fields.isReadonly] = (value.indexOf('true') > -1);
27588
- break;
27589
- case 'RRULE':
27590
- curEvent[fields.recurrenceRule] = value;
27591
- break;
27592
- default:
27593
- if (_this.parent.resourceCollection.length > 0) {
27594
- var resData = _this.parent.resourceCollection.filter(function (data) { return data.field === type; });
27595
- curEvent["" + type] = (resData.length > 0 && (typeof (resData[0].dataSource[0][resData[0].idField]) == 'number')) ? parseInt(value, 10) : value;
27596
- }
27597
- else {
27598
- curEvent["" + type] = value;
27559
+ iString = iCalString.slice(lastPosition, position - newlineOffset);
27560
+ }
27561
+ lastPosition = position;
27562
+ } while (position !== iStringLength);
27563
+ iString = iString.trim();
27564
+ if (iString.length) {
27565
+ iCalData = this.updateEventData(iString, iCalData);
27566
+ }
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++;
27599
27625
  }
27600
- }
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
+ }
27601
27659
  }
27602
27660
  }
27603
- });
27604
- var app = extend([], events, null, true);
27605
- this.parent.addEvent(this.processOccurrence(app, id));
27661
+ }
27662
+ return { isEvent: isEvent, curEvent: curEvent, id: id, count: count, events: events, key: key };
27606
27663
  };
27607
27664
  ICalendarImport.prototype.processOccurrence = function (app, maxId) {
27608
27665
  var _this = this;
@@ -27667,7 +27724,7 @@ var ICalendarImport = /** @__PURE__ @class */ (function () {
27667
27724
  }
27668
27725
  return parentException + ',' + occurrenceException;
27669
27726
  };
27670
- ICalendarImport.prototype.getDateString = function (value) {
27727
+ ICalendarImport.prototype.getFormattedString = function (value) {
27671
27728
  value = value || '';
27672
27729
  // eslint-disable-next-line no-useless-escape
27673
27730
  return (value.replace(/\\\,/g, ',').replace(/\\\;/g, ';').replace(/\\[nN]/g, '\n').replace(/\\\\/g, '\\'));
@@ -27675,7 +27732,7 @@ var ICalendarImport = /** @__PURE__ @class */ (function () {
27675
27732
  ICalendarImport.prototype.dateParsing = function (element) {
27676
27733
  var split = element.split(':');
27677
27734
  var value = split[split.length - 1];
27678
- var newDate = new Date(this.getDateString(value));
27735
+ var newDate = new Date(this.getFormattedString(value));
27679
27736
  if (element && (element.indexOf('VALUE=DATE') > -1 || element.indexOf('RECURRENCE-ID;TZID') > -1)) {
27680
27737
  var data_1 = /^(\d{4})(\d{2})(\d{2})$/.exec(value);
27681
27738
  if (data_1 !== null) {