@syncfusion/ej2-schedule 20.2.36 → 20.2.43

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.
@@ -5185,7 +5185,7 @@ var EventBase = /** @__PURE__ @class */ (function () {
5185
5185
  if (timeZonePropChanged) {
5186
5186
  this_1.processTimezoneChange(event_1, oldTimezone);
5187
5187
  }
5188
- else if (!this_1.parent.isPrinting && !this_1.parent.uiStateValues.isResize) {
5188
+ else if (!this_1.parent.isPrinting && !this_1.parent.uiStateValues.isPreventTimezone) {
5189
5189
  event_1 = this_1.processTimezone(event_1);
5190
5190
  }
5191
5191
  for (var level = 0; level < resourceCollection.length; level++) {
@@ -6047,6 +6047,7 @@ var EventBase = /** @__PURE__ @class */ (function () {
6047
6047
  for (var _i = 0, dates_1 = dates; _i < dates_1.length; _i++) {
6048
6048
  var date = dates_1[_i];
6049
6049
  var clonedObject = extend({}, event, null, true);
6050
+ date = this.getDSTAdjustedTime(date, clonedObject);
6050
6051
  clonedObject[this.parent.eventFields.startTime] = new Date(date);
6051
6052
  clonedObject[this.parent.eventFields.endTime] = new Date(new Date(date).setMilliseconds(duration));
6052
6053
  clonedObject[this.parent.eventFields.recurrenceID] = clonedObject[this.parent.eventFields.id];
@@ -6057,6 +6058,21 @@ var EventBase = /** @__PURE__ @class */ (function () {
6057
6058
  }
6058
6059
  return occurrenceCollection;
6059
6060
  };
6061
+ EventBase.prototype.getDSTAdjustedTime = function (date, event) {
6062
+ var occurDate = date;
6063
+ if (this.parent.timezone &&
6064
+ (event[this.parent.eventFields.startTimezone] || event[this.parent.eventFields.endTimezone])) {
6065
+ var eventOffset = this.getDSTDiff(event[this.parent.eventFields.startTime], new Date(date), event[this.parent.eventFields.startTimezone]);
6066
+ var schOffset = this.getDSTDiff(event[this.parent.eventFields.startTime], new Date(date), this.parent.timezone);
6067
+ occurDate = (new Date(date).getTime() - (eventOffset - schOffset) * 60000);
6068
+ }
6069
+ return occurDate;
6070
+ };
6071
+ EventBase.prototype.getDSTDiff = function (startDate, occurDate, timezone) {
6072
+ var startOffset = this.parent.tzModule.offset(new Date(startDate), timezone);
6073
+ var occurOffset = this.parent.tzModule.offset(new Date(occurDate), timezone);
6074
+ return startOffset - occurOffset;
6075
+ };
6060
6076
  EventBase.prototype.getParentEvent = function (eventObj, isParent) {
6061
6077
  if (isParent === void 0) { isParent = false; }
6062
6078
  var parentEvent;
@@ -11537,6 +11553,7 @@ var EventWindow = /** @__PURE__ @class */ (function () {
11537
11553
  EventWindow.prototype.setDialogContent = function () {
11538
11554
  this.dialogObject.content = this.getEventWindowContent();
11539
11555
  this.dialogObject.dataBind();
11556
+ this.applyFormValidation();
11540
11557
  };
11541
11558
  EventWindow.prototype.preventEventSave = function (e) {
11542
11559
  if (this.parent && !this.parent.allowKeyboardInteraction && e.code === 'Enter') {
@@ -13766,7 +13783,7 @@ var Crud = /** @__PURE__ @class */ (function () {
13766
13783
  var resultData = extend([], args.result, null, true);
13767
13784
  _this.parent.eventsData = resultData.filter(function (data) { return !data[_this.parent.eventFields.isBlock]; });
13768
13785
  _this.parent.blockData = resultData.filter(function (data) { return data[_this.parent.eventFields.isBlock]; });
13769
- _this.parent.refreshEvents(false);
13786
+ _this.refreshProcessedData();
13770
13787
  if (_this.parent.dragAndDropModule && _this.parent.dragAndDropModule.actionObj.action === 'drag') {
13771
13788
  _this.parent.dragAndDropModule.navigationWrapper();
13772
13789
  }
@@ -13785,6 +13802,31 @@ var Crud = /** @__PURE__ @class */ (function () {
13785
13802
  }
13786
13803
  this.parent.trigger(actionFailure, { error: e }, function () { return _this.parent.hideSpinner(); });
13787
13804
  };
13805
+ Crud.prototype.refreshProcessedData = function () {
13806
+ if (this.parent.dragAndDropModule) {
13807
+ this.parent.dragAndDropModule.actionObj.action = '';
13808
+ removeClass([this.parent.element], 'e-event-action');
13809
+ }
13810
+ if (this.parent.activeViewOptions && this.parent.activeViewOptions.eventTemplate) {
13811
+ var templateNames = ['eventTemplate'];
13812
+ if (this.crudObj.isCrudAction &&
13813
+ ['Agenda', 'MonthAgenda', 'Year', 'TimelineYear'].indexOf(this.parent.currentView) === -1) {
13814
+ templateNames = [];
13815
+ for (var i = 0, len = this.crudObj.sourceEvent.length; i < len; i++) {
13816
+ templateNames.push('eventTemplate_' + this.crudObj.sourceEvent[i].groupIndex);
13817
+ if (this.crudObj.targetEvent[i] && this.crudObj.sourceEvent[i].groupIndex !==
13818
+ this.crudObj.targetEvent[i].groupIndex) {
13819
+ templateNames.push('eventTemplate_' + this.crudObj.targetEvent[i].groupIndex);
13820
+ }
13821
+ }
13822
+ }
13823
+ this.parent.resetTemplates(templateNames);
13824
+ }
13825
+ var eventsData = this.parent.eventsData || [];
13826
+ var blockData = this.parent.blockData || [];
13827
+ var data = eventsData.concat(blockData);
13828
+ this.parent.notify(dataReady, { processedData: this.parent.eventBase ? this.parent.eventBase.processData(data) : [] });
13829
+ };
13788
13830
  Crud.prototype.refreshData = function (args) {
13789
13831
  var _this = this;
13790
13832
  var actionArgs = {
@@ -16502,7 +16544,7 @@ var Schedule = /** @__PURE__ @class */ (function (_super) {
16502
16544
  if (this && isNullOrUndefined(this.uiStateValues) || !(this.enablePersistence)) {
16503
16545
  this.uiStateValues = {
16504
16546
  expand: false, isInitial: true, left: 0, top: 0, isGroupAdaptive: false,
16505
- isIgnoreOccurrence: false, groupIndex: 0, action: false, isBlock: false, isCustomMonth: true, isResize: false
16547
+ isIgnoreOccurrence: false, groupIndex: 0, action: false, isBlock: false, isCustomMonth: true, isPreventTimezone: false
16506
16548
  };
16507
16549
  }
16508
16550
  this.activeCellsData = { startTime: this.getCurrentTime(), endTime: this.getCurrentTime(), isAllDay: false };
@@ -16964,11 +17006,9 @@ var Schedule = /** @__PURE__ @class */ (function (_super) {
16964
17006
  }
16965
17007
  if (this.currentView === 'Month' || ((this.currentView !== 'Agenda' && this.currentView !== 'MonthAgenda')
16966
17008
  && !this.activeViewOptions.timeScale.enable) || this.activeView.isTimelineView()) {
16967
- this.uiStateValues.isResize = true;
16968
17009
  this.activeView.resetColWidth();
16969
17010
  this.notify(scrollUiUpdate, { cssProperties: this.getCssProperties(), isPreventScrollUpdate: true });
16970
17011
  this.refreshEvents(false);
16971
- this.uiStateValues.isResize = false;
16972
17012
  }
16973
17013
  else {
16974
17014
  this.notify(contentReady, {});
@@ -18040,25 +18080,15 @@ var Schedule = /** @__PURE__ @class */ (function (_super) {
18040
18080
  this.crudModule.refreshDataManager();
18041
18081
  }
18042
18082
  else {
18043
- if (this.activeViewOptions && this.activeViewOptions.eventTemplate) {
18044
- var templateNames = ['eventTemplate'];
18045
- if (this.crudModule && this.crudModule.crudObj.isCrudAction &&
18046
- ['Agenda', 'MonthAgenda', 'Year', 'TimelineYear'].indexOf(this.currentView) === -1) {
18047
- templateNames = [];
18048
- for (var i = 0, len = this.crudModule.crudObj.sourceEvent.length; i < len; i++) {
18049
- templateNames.push('eventTemplate_' + this.crudModule.crudObj.sourceEvent[i].groupIndex);
18050
- if (this.crudModule.crudObj.targetEvent[i] && this.crudModule.crudObj.sourceEvent[i].groupIndex !==
18051
- this.crudModule.crudObj.targetEvent[i].groupIndex) {
18052
- templateNames.push('eventTemplate_' + this.crudModule.crudObj.targetEvent[i].groupIndex);
18053
- }
18054
- }
18055
- }
18056
- this.resetTemplates(templateNames);
18083
+ if (this.uiStateValues) {
18084
+ this.uiStateValues.isPreventTimezone = true;
18085
+ }
18086
+ if (this.crudModule) {
18087
+ this.crudModule.refreshProcessedData();
18088
+ }
18089
+ if (this.uiStateValues) {
18090
+ this.uiStateValues.isPreventTimezone = false;
18057
18091
  }
18058
- var eventsData = this.eventsData || [];
18059
- var blockData = this.blockData || [];
18060
- var data = eventsData.concat(blockData);
18061
- this.notify(dataReady, { processedData: this.eventBase ? this.eventBase.processData(data) : [] });
18062
18092
  }
18063
18093
  };
18064
18094
  /**
@@ -24078,6 +24108,14 @@ var Year = /** @__PURE__ @class */ (function (_super) {
24078
24108
  EventHandler.add(element, 'scroll', this.onContentScroll, this);
24079
24109
  }
24080
24110
  };
24111
+ Year.prototype.scrollToDate = function (scrollDate) {
24112
+ var date = +new Date(resetTime(scrollDate));
24113
+ var element = this.element.querySelector('.' + WORK_CELLS_CLASS + ':not(.' + OTHERMONTH_CLASS + ')[data-date="' + date + '"]');
24114
+ if (element) {
24115
+ element = closest(element, '.e-month-calendar');
24116
+ this.getContentAreaElement().scrollTop = element.offsetTop;
24117
+ }
24118
+ };
24081
24119
  Year.prototype.destroy = function () {
24082
24120
  if (!this.parent || this.parent && this.parent.isDestroyed) {
24083
24121
  return;
@@ -24912,6 +24950,20 @@ var Agenda = /** @__PURE__ @class */ (function (_super) {
24912
24950
  contentArea.style.height = formatUnit(this.parent.element.offsetHeight - headerHeight);
24913
24951
  }
24914
24952
  };
24953
+ Agenda.prototype.scrollToDate = function (scrollDate) {
24954
+ var date = new Date(+resetTime(scrollDate));
24955
+ if (this.parent.activeViewOptions.allowVirtualScrolling) {
24956
+ if (!this.parent.hideEmptyAgendaDays || this.parent.getEvents(date, addDays(date, 1), true).length > 0) {
24957
+ this.parent.changeDate(date);
24958
+ }
24959
+ }
24960
+ else {
24961
+ var dateElement = this.element.querySelector('.' + AGENDA_CELLS_CLASS + '[data-date="' + date.getTime() + '"]');
24962
+ if (dateElement) {
24963
+ this.getContentAreaElement().scrollTop = dateElement.offsetTop;
24964
+ }
24965
+ }
24966
+ };
24915
24967
  Agenda.prototype.destroy = function () {
24916
24968
  if (!this.parent || this.parent && this.parent.isDestroyed) {
24917
24969
  return;
@@ -25273,9 +25325,12 @@ var TimelineViews = /** @__PURE__ @class */ (function (_super) {
25273
25325
  if (scrollDate) {
25274
25326
  index = this.parent.getIndexOfDate(this.renderDates, resetTime(scrollDate));
25275
25327
  if (index >= 0) {
25276
- var timeString = hour.split(':');
25277
- if (timeString.length === 2) {
25278
- date = new Date(scrollDate.setHours(parseInt(timeString[0], 10), parseInt(timeString[1], 10), 0));
25328
+ date = scrollDate;
25329
+ if (!isNullOrUndefined(hour)) {
25330
+ var timeString = hour.split(':');
25331
+ if (timeString.length === 2) {
25332
+ date = new Date(scrollDate.setHours(parseInt(timeString[0], 10), parseInt(timeString[1], 10), 0));
25333
+ }
25279
25334
  }
25280
25335
  }
25281
25336
  }
@@ -25283,8 +25338,14 @@ var TimelineViews = /** @__PURE__ @class */ (function (_super) {
25283
25338
  if (isNullOrUndefined(date)) {
25284
25339
  return;
25285
25340
  }
25286
- var scrollLeft = isNullOrUndefined(scrollDate) ? this.getLeftFromDateTime(null, date) :
25287
- this.getLeftFromDateTime([index], date);
25341
+ var scrollLeft;
25342
+ if (isNullOrUndefined(hour) || !this.parent.activeViewOptions.timeScale.enable) {
25343
+ scrollLeft = index * this.getWorkCellWidth();
25344
+ }
25345
+ else {
25346
+ scrollLeft = isNullOrUndefined(scrollDate) ? this.getLeftFromDateTime(null, date) :
25347
+ this.getLeftFromDateTime([index], date);
25348
+ }
25288
25349
  this.getScrollableElement().scrollLeft = !this.parent.enableRtl ? scrollLeft : -scrollLeft;
25289
25350
  };
25290
25351
  TimelineViews.prototype.generateColumnLevels = function () {
@@ -26081,13 +26142,25 @@ var TimelineYear = /** @__PURE__ @class */ (function (_super) {
26081
26142
  append(cellTemplate, td);
26082
26143
  };
26083
26144
  TimelineYear.prototype.scrollToDate = function (scrollDate) {
26084
- if (this.parent.activeViewOptions.group.resources.length === 0) {
26085
- var date = +new Date(resetTime(scrollDate));
26086
- var element = this.element.querySelector('[data-date="' + date + '"]');
26087
- if (element) {
26088
- this.getScrollableElement().scrollLeft = element.offsetLeft;
26089
- this.getScrollableElement().scrollTop = element.offsetTop;
26145
+ var date;
26146
+ if (this.parent.activeViewOptions.group.resources !== null && this.parent.activeViewOptions.group.resources.length > 0 &&
26147
+ !this.parent.uiStateValues.isGroupAdaptive) {
26148
+ date = +new Date(resetTime(firstDateOfMonth(scrollDate)));
26149
+ }
26150
+ else {
26151
+ date = +new Date(resetTime(scrollDate));
26152
+ }
26153
+ var element = this.element.querySelector('[data-date="' + date + '"]');
26154
+ if (element) {
26155
+ var wrap = this.getScrollableElement();
26156
+ if (this.parent.enableRtl) {
26157
+ var conTable = this.element.querySelector('.' + CONTENT_TABLE_CLASS);
26158
+ wrap.scrollLeft = -(conTable.offsetWidth - element.offsetLeft - element.offsetWidth);
26090
26159
  }
26160
+ else {
26161
+ wrap.scrollLeft = element.offsetLeft;
26162
+ }
26163
+ wrap.scrollTop = element.offsetTop;
26091
26164
  }
26092
26165
  };
26093
26166
  TimelineYear.prototype.getScrollableElement = function () {
@@ -26110,6 +26183,10 @@ var ICalendarExport = /** @__PURE__ @class */ (function () {
26110
26183
  this.parent = parent;
26111
26184
  }
26112
26185
  ICalendarExport.prototype.initializeCalendarExport = function (fileName, customData) {
26186
+ var icsString = this.getCalendarString(fileName, customData);
26187
+ this.download(icsString, fileName);
26188
+ };
26189
+ ICalendarExport.prototype.getCalendarString = function (fileName, customData) {
26113
26190
  var _this = this;
26114
26191
  var eventsData = (customData) ? customData :
26115
26192
  extend([], this.parent.eventsData, null, true);
@@ -26120,7 +26197,7 @@ var ICalendarExport = /** @__PURE__ @class */ (function () {
26120
26197
  var timeZone = this.parent.timezone || this.parent.tzModule.getLocalTimezoneName();
26121
26198
  var fields = this.parent.eventFields;
26122
26199
  eventsData.forEach(function (eventObj) {
26123
- var uId = _this.parent.eventBase.generateGuid();
26200
+ var uId = eventObj[fields.id] || eventObj.Guid || _this.parent.eventBase.generateGuid();
26124
26201
  var editedExDate = [];
26125
26202
  if (eventObj[fields.recurrenceID]) {
26126
26203
  var filter = _this.filterEvents(filterCollection, fields.id, eventObj[fields.recurrenceID]);
@@ -26195,7 +26272,7 @@ var ICalendarExport = /** @__PURE__ @class */ (function () {
26195
26272
  'X-WR-TIMEZONE:' + timeZone
26196
26273
  ].join(SEPARATOR);
26197
26274
  var icsString = iCalendar + SEPARATOR + iCalendarEvents.join(SEPARATOR) + SEPARATOR + 'END:VCALENDAR';
26198
- this.download(icsString, fileName);
26275
+ return icsString;
26199
26276
  };
26200
26277
  ICalendarExport.prototype.customFieldFilter = function (eventObj, fields) {
26201
26278
  var defaultFields = Object.keys(fields).map(function (key) { return fields[key]; });
@@ -26324,8 +26401,16 @@ var ICalendarImport = /** @__PURE__ @class */ (function () {
26324
26401
  break;
26325
26402
  case 'UID':
26326
26403
  curEvent[uId] = value;
26327
- curEvent[fields.id] = typeof (id) === 'string' ? id + count.toString() : id + count;
26328
- count++;
26404
+ if (typeof (id) == 'number') {
26405
+ curEvent[fields.id] = parseInt(value, 10);
26406
+ if (isNaN(curEvent[fields.id])) {
26407
+ curEvent[fields.id] = id + count;
26408
+ count++;
26409
+ }
26410
+ }
26411
+ else {
26412
+ curEvent[fields.id] = value;
26413
+ }
26329
26414
  break;
26330
26415
  case 'SUMMARY':
26331
26416
  curEvent[fields.subject] = value;
@@ -26361,6 +26446,10 @@ var ICalendarImport = /** @__PURE__ @class */ (function () {
26361
26446
  var appoint = [];
26362
26447
  var uId = 'UID';
26363
26448
  var fields = this.parent.eventFields;
26449
+ var appointmentIds = [];
26450
+ this.parent.eventsData.forEach(function (eventObj) {
26451
+ appointmentIds.push(eventObj[fields.id]);
26452
+ });
26364
26453
  app.forEach(function (eventObj) {
26365
26454
  var parentObj;
26366
26455
  var id;
@@ -26369,24 +26458,26 @@ var ICalendarImport = /** @__PURE__ @class */ (function () {
26369
26458
  parentObj = eventObj;
26370
26459
  id = eventObj[fields.id];
26371
26460
  }
26372
- var data = app.filter(function (data) { return data.UID === eventObj[uId]; });
26373
- if (data.length > 1 && isNullOrUndefined(eventObj[fields.recurrenceID])) {
26374
- for (var i = 0; i < data.length; i++) {
26375
- // eslint-disable-next-line no-prototype-builtins
26376
- if (data[i].hasOwnProperty(fields.recurrenceID)) {
26377
- var exdate = data[i][fields.recurrenceID];
26378
- data[i][fields.recurrenceID] = id;
26379
- data[i][fields.recurrenceException] = null;
26380
- parentObj[fields.recurrenceException] = (isNullOrUndefined(parentObj[fields.recurrenceException])) ?
26381
- exdate : parentObj[fields.recurrenceException] + ',' + exdate;
26382
- appoint.push(data[i]);
26461
+ if (appointmentIds.indexOf(eventObj[fields.id]) < 0) {
26462
+ var data = app.filter(function (data) { return data.UID === eventObj[uId]; });
26463
+ if (data.length > 1 && isNullOrUndefined(eventObj[fields.recurrenceID])) {
26464
+ for (var i = 0; i < data.length; i++) {
26465
+ // eslint-disable-next-line no-prototype-builtins
26466
+ if (data[i].hasOwnProperty(fields.recurrenceID)) {
26467
+ var exdate = data[i][fields.recurrenceID];
26468
+ data[i][fields.recurrenceID] = id;
26469
+ data[i][fields.recurrenceException] = null;
26470
+ parentObj[fields.recurrenceException] = (isNullOrUndefined(parentObj[fields.recurrenceException])) ?
26471
+ exdate : parentObj[fields.recurrenceException] + ',' + exdate;
26472
+ appoint.push(data[i]);
26473
+ }
26383
26474
  }
26475
+ appoint.push(parentObj);
26476
+ // eslint-disable-next-line no-prototype-builtins
26477
+ }
26478
+ else if (!eventObj.hasOwnProperty(fields.recurrenceID)) {
26479
+ appoint.push(eventObj);
26384
26480
  }
26385
- appoint.push(parentObj);
26386
- // eslint-disable-next-line no-prototype-builtins
26387
- }
26388
- else if (!eventObj.hasOwnProperty(fields.recurrenceID)) {
26389
- appoint.push(eventObj);
26390
26481
  }
26391
26482
  });
26392
26483
  return appoint;