@syncfusion/ej2-schedule 20.2.38 → 20.2.45

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.
@@ -5154,7 +5154,7 @@ class EventBase {
5154
5154
  if (timeZonePropChanged) {
5155
5155
  this.processTimezoneChange(event, oldTimezone);
5156
5156
  }
5157
- else if (!this.parent.isPrinting && !this.parent.uiStateValues.isResize) {
5157
+ else if (!this.parent.isPrinting && !this.parent.uiStateValues.isPreventTimezone) {
5158
5158
  event = this.processTimezone(event);
5159
5159
  }
5160
5160
  for (let level = 0; level < resourceCollection.length; level++) {
@@ -13402,7 +13402,7 @@ class Crud {
13402
13402
  const resultData = extend([], args.result, null, true);
13403
13403
  this.parent.eventsData = resultData.filter((data) => !data[this.parent.eventFields.isBlock]);
13404
13404
  this.parent.blockData = resultData.filter((data) => data[this.parent.eventFields.isBlock]);
13405
- this.parent.refreshEvents(false);
13405
+ this.refreshProcessedData();
13406
13406
  if (this.parent.dragAndDropModule && this.parent.dragAndDropModule.actionObj.action === 'drag') {
13407
13407
  this.parent.dragAndDropModule.navigationWrapper();
13408
13408
  }
@@ -13420,6 +13420,31 @@ class Crud {
13420
13420
  }
13421
13421
  this.parent.trigger(actionFailure, { error: e }, () => this.parent.hideSpinner());
13422
13422
  }
13423
+ refreshProcessedData() {
13424
+ if (this.parent.dragAndDropModule) {
13425
+ this.parent.dragAndDropModule.actionObj.action = '';
13426
+ removeClass([this.parent.element], 'e-event-action');
13427
+ }
13428
+ if (this.parent.activeViewOptions && this.parent.activeViewOptions.eventTemplate) {
13429
+ let templateNames = ['eventTemplate'];
13430
+ if (this.crudObj.isCrudAction &&
13431
+ ['Agenda', 'MonthAgenda', 'Year', 'TimelineYear'].indexOf(this.parent.currentView) === -1) {
13432
+ templateNames = [];
13433
+ for (let i = 0, len = this.crudObj.sourceEvent.length; i < len; i++) {
13434
+ templateNames.push('eventTemplate_' + this.crudObj.sourceEvent[i].groupIndex);
13435
+ if (this.crudObj.targetEvent[i] && this.crudObj.sourceEvent[i].groupIndex !==
13436
+ this.crudObj.targetEvent[i].groupIndex) {
13437
+ templateNames.push('eventTemplate_' + this.crudObj.targetEvent[i].groupIndex);
13438
+ }
13439
+ }
13440
+ }
13441
+ this.parent.resetTemplates(templateNames);
13442
+ }
13443
+ const eventsData = this.parent.eventsData || [];
13444
+ const blockData = this.parent.blockData || [];
13445
+ const data = eventsData.concat(blockData);
13446
+ this.parent.notify(dataReady, { processedData: this.parent.eventBase ? this.parent.eventBase.processData(data) : [] });
13447
+ }
13423
13448
  refreshData(args) {
13424
13449
  const actionArgs = {
13425
13450
  requestType: args.requestType, cancel: false, data: args.data,
@@ -15919,7 +15944,7 @@ let Schedule = class Schedule extends Component {
15919
15944
  if (this && isNullOrUndefined(this.uiStateValues) || !(this.enablePersistence)) {
15920
15945
  this.uiStateValues = {
15921
15946
  expand: false, isInitial: true, left: 0, top: 0, isGroupAdaptive: false,
15922
- isIgnoreOccurrence: false, groupIndex: 0, action: false, isBlock: false, isCustomMonth: true, isResize: false
15947
+ isIgnoreOccurrence: false, groupIndex: 0, action: false, isBlock: false, isCustomMonth: true, isPreventTimezone: false
15923
15948
  };
15924
15949
  }
15925
15950
  this.activeCellsData = { startTime: this.getCurrentTime(), endTime: this.getCurrentTime(), isAllDay: false };
@@ -16379,11 +16404,9 @@ let Schedule = class Schedule extends Component {
16379
16404
  }
16380
16405
  if (this.currentView === 'Month' || ((this.currentView !== 'Agenda' && this.currentView !== 'MonthAgenda')
16381
16406
  && !this.activeViewOptions.timeScale.enable) || this.activeView.isTimelineView()) {
16382
- this.uiStateValues.isResize = true;
16383
16407
  this.activeView.resetColWidth();
16384
16408
  this.notify(scrollUiUpdate, { cssProperties: this.getCssProperties(), isPreventScrollUpdate: true });
16385
16409
  this.refreshEvents(false);
16386
- this.uiStateValues.isResize = false;
16387
16410
  }
16388
16411
  else {
16389
16412
  this.notify(contentReady, {});
@@ -17449,25 +17472,15 @@ let Schedule = class Schedule extends Component {
17449
17472
  this.crudModule.refreshDataManager();
17450
17473
  }
17451
17474
  else {
17452
- if (this.activeViewOptions && this.activeViewOptions.eventTemplate) {
17453
- let templateNames = ['eventTemplate'];
17454
- if (this.crudModule && this.crudModule.crudObj.isCrudAction &&
17455
- ['Agenda', 'MonthAgenda', 'Year', 'TimelineYear'].indexOf(this.currentView) === -1) {
17456
- templateNames = [];
17457
- for (let i = 0, len = this.crudModule.crudObj.sourceEvent.length; i < len; i++) {
17458
- templateNames.push('eventTemplate_' + this.crudModule.crudObj.sourceEvent[i].groupIndex);
17459
- if (this.crudModule.crudObj.targetEvent[i] && this.crudModule.crudObj.sourceEvent[i].groupIndex !==
17460
- this.crudModule.crudObj.targetEvent[i].groupIndex) {
17461
- templateNames.push('eventTemplate_' + this.crudModule.crudObj.targetEvent[i].groupIndex);
17462
- }
17463
- }
17464
- }
17465
- this.resetTemplates(templateNames);
17475
+ if (this.uiStateValues) {
17476
+ this.uiStateValues.isPreventTimezone = true;
17477
+ }
17478
+ if (this.crudModule) {
17479
+ this.crudModule.refreshProcessedData();
17480
+ }
17481
+ if (this.uiStateValues) {
17482
+ this.uiStateValues.isPreventTimezone = false;
17466
17483
  }
17467
- const eventsData = this.eventsData || [];
17468
- const blockData = this.blockData || [];
17469
- const data = eventsData.concat(blockData);
17470
- this.notify(dataReady, { processedData: this.eventBase ? this.eventBase.processData(data) : [] });
17471
17484
  }
17472
17485
  }
17473
17486
  /**
@@ -23245,6 +23258,14 @@ class Year extends ViewBase {
23245
23258
  EventHandler.add(element, 'scroll', this.onContentScroll, this);
23246
23259
  }
23247
23260
  }
23261
+ scrollToDate(scrollDate) {
23262
+ const date = +new Date(resetTime(scrollDate));
23263
+ let element = this.element.querySelector('.' + WORK_CELLS_CLASS + ':not(.' + OTHERMONTH_CLASS + ')[data-date="' + date + '"]');
23264
+ if (element) {
23265
+ element = closest(element, '.e-month-calendar');
23266
+ this.getContentAreaElement().scrollTop = element.offsetTop;
23267
+ }
23268
+ }
23248
23269
  destroy() {
23249
23270
  if (!this.parent || this.parent && this.parent.isDestroyed) {
23250
23271
  return;
@@ -24037,6 +24058,20 @@ class Agenda extends AgendaBase {
24037
24058
  contentArea.style.height = formatUnit(this.parent.element.offsetHeight - headerHeight);
24038
24059
  }
24039
24060
  }
24061
+ scrollToDate(scrollDate) {
24062
+ const date = new Date(+resetTime(scrollDate));
24063
+ if (this.parent.activeViewOptions.allowVirtualScrolling) {
24064
+ if (!this.parent.hideEmptyAgendaDays || this.parent.getEvents(date, addDays(date, 1), true).length > 0) {
24065
+ this.parent.changeDate(date);
24066
+ }
24067
+ }
24068
+ else {
24069
+ const dateElement = this.element.querySelector('.' + AGENDA_CELLS_CLASS + '[data-date="' + date.getTime() + '"]');
24070
+ if (dateElement) {
24071
+ this.getContentAreaElement().scrollTop = dateElement.offsetTop;
24072
+ }
24073
+ }
24074
+ }
24040
24075
  destroy() {
24041
24076
  if (!this.parent || this.parent && this.parent.isDestroyed) {
24042
24077
  return;
@@ -24356,9 +24391,12 @@ class TimelineViews extends VerticalView {
24356
24391
  if (scrollDate) {
24357
24392
  index = this.parent.getIndexOfDate(this.renderDates, resetTime(scrollDate));
24358
24393
  if (index >= 0) {
24359
- const timeString = hour.split(':');
24360
- if (timeString.length === 2) {
24361
- date = new Date(scrollDate.setHours(parseInt(timeString[0], 10), parseInt(timeString[1], 10), 0));
24394
+ date = scrollDate;
24395
+ if (!isNullOrUndefined(hour)) {
24396
+ const timeString = hour.split(':');
24397
+ if (timeString.length === 2) {
24398
+ date = new Date(scrollDate.setHours(parseInt(timeString[0], 10), parseInt(timeString[1], 10), 0));
24399
+ }
24362
24400
  }
24363
24401
  }
24364
24402
  }
@@ -24366,8 +24404,14 @@ class TimelineViews extends VerticalView {
24366
24404
  if (isNullOrUndefined(date)) {
24367
24405
  return;
24368
24406
  }
24369
- const scrollLeft = isNullOrUndefined(scrollDate) ? this.getLeftFromDateTime(null, date) :
24370
- this.getLeftFromDateTime([index], date);
24407
+ let scrollLeft;
24408
+ if (isNullOrUndefined(hour) || !this.parent.activeViewOptions.timeScale.enable) {
24409
+ scrollLeft = index * this.getWorkCellWidth();
24410
+ }
24411
+ else {
24412
+ scrollLeft = isNullOrUndefined(scrollDate) ? this.getLeftFromDateTime(null, date) :
24413
+ this.getLeftFromDateTime([index], date);
24414
+ }
24371
24415
  this.getScrollableElement().scrollLeft = !this.parent.enableRtl ? scrollLeft : -scrollLeft;
24372
24416
  }
24373
24417
  generateColumnLevels() {
@@ -25124,13 +25168,25 @@ class TimelineYear extends Year {
25124
25168
  append(cellTemplate, td);
25125
25169
  }
25126
25170
  scrollToDate(scrollDate) {
25127
- if (this.parent.activeViewOptions.group.resources.length === 0) {
25128
- const date = +new Date(resetTime(scrollDate));
25129
- const element = this.element.querySelector('[data-date="' + date + '"]');
25130
- if (element) {
25131
- this.getScrollableElement().scrollLeft = element.offsetLeft;
25132
- this.getScrollableElement().scrollTop = element.offsetTop;
25171
+ let date;
25172
+ if (this.parent.activeViewOptions.group.resources !== null && this.parent.activeViewOptions.group.resources.length > 0 &&
25173
+ !this.parent.uiStateValues.isGroupAdaptive) {
25174
+ date = +new Date(resetTime(firstDateOfMonth(scrollDate)));
25175
+ }
25176
+ else {
25177
+ date = +new Date(resetTime(scrollDate));
25178
+ }
25179
+ const element = this.element.querySelector('[data-date="' + date + '"]');
25180
+ if (element) {
25181
+ const wrap = this.getScrollableElement();
25182
+ if (this.parent.enableRtl) {
25183
+ const conTable = this.element.querySelector('.' + CONTENT_TABLE_CLASS);
25184
+ wrap.scrollLeft = -(conTable.offsetWidth - element.offsetLeft - element.offsetWidth);
25133
25185
  }
25186
+ else {
25187
+ wrap.scrollLeft = element.offsetLeft;
25188
+ }
25189
+ wrap.scrollTop = element.offsetTop;
25134
25190
  }
25135
25191
  }
25136
25192
  getScrollableElement() {
@@ -25152,6 +25208,10 @@ class ICalendarExport {
25152
25208
  this.parent = parent;
25153
25209
  }
25154
25210
  initializeCalendarExport(fileName, customData) {
25211
+ const icsString = this.getCalendarString(fileName, customData);
25212
+ this.download(icsString, fileName);
25213
+ }
25214
+ getCalendarString(fileName, customData) {
25155
25215
  let eventsData = (customData) ? customData :
25156
25216
  extend([], this.parent.eventsData, null, true);
25157
25217
  eventsData = this.parent.eventBase.sortByTime(eventsData);
@@ -25234,7 +25294,7 @@ class ICalendarExport {
25234
25294
  'X-WR-TIMEZONE:' + timeZone
25235
25295
  ].join(SEPARATOR);
25236
25296
  const icsString = iCalendar + SEPARATOR + iCalendarEvents.join(SEPARATOR) + SEPARATOR + 'END:VCALENDAR';
25237
- this.download(icsString, fileName);
25297
+ return icsString;
25238
25298
  }
25239
25299
  customFieldFilter(eventObj, fields) {
25240
25300
  const defaultFields = Object.keys(fields).map((key) => fields[key]);