@syncfusion/ej2-schedule 20.3.49 → 20.3.52

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.
@@ -1613,8 +1613,8 @@ var ScheduleTouch = /** @__PURE__ @class */ (function () {
1613
1613
  }
1614
1614
  ScheduleTouch.prototype.scrollHandler = function (e) {
1615
1615
  if (this.parent.currentView === 'Agenda' || this.parent.uiStateValues.action || !this.parent.allowSwiping ||
1616
- (e.originalEvent && (e.originalEvent.target.classList.contains(APPOINTMENT_CLASS) ||
1617
- closest(e.originalEvent.target, '.' + APPOINTMENT_CLASS)))) {
1616
+ (e.originalEvent && e.originalEvent.target && (e.originalEvent.target.classList.contains(APPOINTMENT_CLASS) ||
1617
+ closest(e.originalEvent.target, '.' + APPOINTMENT_CLASS)) && !this.parent.isAdaptive)) {
1618
1618
  return;
1619
1619
  }
1620
1620
  if (!this.timeStampStart) {
@@ -1850,6 +1850,7 @@ var KeyboardInteraction = /** @__PURE__ @class */ (function () {
1850
1850
  enter: 'enter',
1851
1851
  escape: 'escape',
1852
1852
  delete: 'delete',
1853
+ backspace: 'backspace',
1853
1854
  home: 'home',
1854
1855
  pageUp: 'pageup',
1855
1856
  pageDown: 'pagedown',
@@ -1921,6 +1922,7 @@ var KeyboardInteraction = /** @__PURE__ @class */ (function () {
1921
1922
  this.processTab(e, e.shiftKey);
1922
1923
  break;
1923
1924
  case 'delete':
1925
+ case 'backspace':
1924
1926
  this.processDelete(e);
1925
1927
  break;
1926
1928
  case 'ctrlShiftUpArrow':
@@ -3072,9 +3074,11 @@ var Gregorian = /** @__PURE__ @class */ (function () {
3072
3074
  }
3073
3075
  };
3074
3076
  Gregorian.prototype.setMonth = function (date, interval, startDate) {
3077
+ date.setDate(1);
3075
3078
  date.setFullYear(date.getFullYear());
3076
3079
  date.setMonth(interval - 1);
3077
- date.setDate(startDate);
3080
+ var maxDay = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
3081
+ date.setDate(Math.min(startDate, maxDay));
3078
3082
  };
3079
3083
  Gregorian.prototype.addYears = function (date, interval) {
3080
3084
  date.setFullYear(date.getFullYear() + interval);
@@ -6019,7 +6023,8 @@ var EventBase = /** @__PURE__ @class */ (function () {
6019
6023
  }
6020
6024
  if (idType === 'number') {
6021
6025
  var datas = this.parent.eventsData.concat(this.parent.blockData);
6022
- var maxId = Math.max.apply(Math, datas.map(function (event) { return event[_this.parent.eventFields.id]; }));
6026
+ var appIds = datas.map(function (event) { return event[_this.parent.eventFields.id]; });
6027
+ var maxId = appIds.reduce(function (a, b) { return Math.max(a, b); });
6023
6028
  maxId = isNullOrUndefined(resourceId) ? maxId : maxId + resourceId;
6024
6029
  eventId = maxId + 1;
6025
6030
  }
@@ -8187,7 +8192,13 @@ var TimelineEvent = /** @__PURE__ @class */ (function (_super) {
8187
8192
  eventObj[this.fields.endTime] = eventData[this.fields.endTime];
8188
8193
  var currentDate = resetTime(new Date(this.dateRender[this.day].getTime()));
8189
8194
  var schedule = getStartEndHours(currentDate, this.startHour, this.endHour);
8190
- var isValidEvent = this.isValidEvent(eventObj, startTime, endTime, schedule);
8195
+ var isValidEvent = true;
8196
+ if (this.isDayProcess() || eventObj[this.fields.isAllDay]) {
8197
+ isValidEvent = true;
8198
+ }
8199
+ else {
8200
+ isValidEvent = this.isValidEvent(eventObj, startTime, endTime, schedule);
8201
+ }
8191
8202
  if (startTime <= endTime && isValidEvent) {
8192
8203
  var appWidth_1 = this.getEventWidth(startTime, endTime, event[this.fields.isAllDay], diffInDays);
8193
8204
  appWidth_1 = this.renderType === 'day' ? appWidth_1 - 2 : appWidth_1;
@@ -8350,14 +8361,19 @@ var TimelineEvent = /** @__PURE__ @class */ (function (_super) {
8350
8361
  TimelineEvent.prototype.getStartTime = function (event, eventData) {
8351
8362
  var startTime = event[this.fields.startTime];
8352
8363
  var schedule = getStartEndHours(startTime, this.startHour, this.endHour);
8353
- if (schedule.startHour.getTime() >= eventData[this.fields.startTime]) {
8354
- startTime = schedule.startHour;
8355
- }
8356
- else if (schedule.endHour.getTime() <= eventData[this.fields.startTime]) {
8357
- startTime = this.getNextDay(schedule.startHour, eventData);
8364
+ if (this.isDayProcess()) {
8365
+ startTime = event[this.fields.startTime];
8358
8366
  }
8359
8367
  else {
8360
- startTime = eventData[this.fields.startTime];
8368
+ if (schedule.startHour.getTime() >= eventData[this.fields.startTime]) {
8369
+ startTime = schedule.startHour;
8370
+ }
8371
+ else if (schedule.endHour.getTime() <= eventData[this.fields.startTime]) {
8372
+ startTime = this.getNextDay(schedule.startHour, eventData);
8373
+ }
8374
+ else {
8375
+ startTime = eventData[this.fields.startTime];
8376
+ }
8361
8377
  }
8362
8378
  // To overcome the overflow
8363
8379
  eventData.trimStartTime = (event[this.fields.isAllDay]) ? schedule.startHour : eventData[this.fields.startTime];
@@ -8377,17 +8393,15 @@ var TimelineEvent = /** @__PURE__ @class */ (function (_super) {
8377
8393
  TimelineEvent.prototype.getEndTime = function (event, eventData) {
8378
8394
  var endTime = event[this.fields.endTime];
8379
8395
  var schedule = getStartEndHours(endTime, this.startHour, this.endHour);
8380
- if (this.parent.currentView === 'TimelineMonth' || !this.parent.activeViewOptions.timeScale.enable ||
8381
- (this.parent.activeViewOptions.headerRows.length > 0 &&
8382
- this.parent.activeViewOptions.headerRows.slice(-1)[0].option !== 'Hour')) {
8396
+ if (this.isDayProcess()) {
8383
8397
  endTime = eventData[this.fields.endTime];
8384
8398
  }
8385
8399
  else {
8386
8400
  endTime = eventData[this.fields.endTime];
8387
- if (schedule.endHour.getTime() <= eventData[this.fields.endTime]) {
8401
+ if (schedule.endHour.getTime() <= eventData[this.fields.endTime] || event[this.fields.isAllDay]) {
8388
8402
  endTime = schedule.endHour;
8389
8403
  }
8390
- if (schedule.startHour.getTime() >= eventData[this.fields.endTime].getTime() && !event.isAllDay) {
8404
+ if (schedule.startHour.getTime() >= eventData[this.fields.endTime].getTime() && !event[this.fields.isAllDay]) {
8391
8405
  endTime = this.getPreviousDay(schedule.startHour, schedule.endHour, eventData);
8392
8406
  }
8393
8407
  }
@@ -8540,6 +8554,14 @@ var TimelineEvent = /** @__PURE__ @class */ (function (_super) {
8540
8554
  'height': (this.cellHeight - (this.maxHeight ? 0 : EVENT_GAP$1) - (this.maxHeight ? 0 : this.moreIndicatorHeight)) + 'px'
8541
8555
  });
8542
8556
  };
8557
+ TimelineEvent.prototype.isDayProcess = function () {
8558
+ if (this.parent.currentView === 'TimelineMonth' || !this.parent.activeViewOptions.timeScale.enable ||
8559
+ (this.parent.activeViewOptions.headerRows.length > 0 &&
8560
+ this.parent.activeViewOptions.headerRows.slice(-1)[0].option !== 'Hour')) {
8561
+ return true;
8562
+ }
8563
+ return false;
8564
+ };
8543
8565
  TimelineEvent.prototype.destroy = function () {
8544
8566
  this.renderType = null;
8545
8567
  this.eventContainers = null;
@@ -12014,7 +12036,8 @@ var EventWindow = /** @__PURE__ @class */ (function () {
12014
12036
  var filter = resourceModel.dataSource.filter(function (data) {
12015
12037
  return data[resourceModel.groupIDField] === args.value[j];
12016
12038
  })[0];
12017
- var groupId = filter[resourceCollection[i + 1].groupIDField];
12039
+ var groupId = (!isNullOrUndefined(filter)) ?
12040
+ filter[resourceCollection[i + 1].groupIDField] : null;
12018
12041
  var filterRes = this_1.filterDatasource(i, groupId);
12019
12042
  datasource = datasource.concat(filterRes);
12020
12043
  };
@@ -12031,6 +12054,7 @@ var EventWindow = /** @__PURE__ @class */ (function () {
12031
12054
  var resourceData = this.parent.resourceBase.resourceCollection[index + 1];
12032
12055
  var resObject = this.element.querySelector('.e-' + resourceData.field).
12033
12056
  ej2_instances[0];
12057
+ resObject.clear();
12034
12058
  return resObject;
12035
12059
  };
12036
12060
  EventWindow.prototype.onDropdownResourceChange = function (args) {
@@ -12045,7 +12069,8 @@ var EventWindow = /** @__PURE__ @class */ (function () {
12045
12069
  var groupId = args.itemData[resourceCollection[i].idField];
12046
12070
  resObj.dataSource = this.filterDatasource(i, groupId);
12047
12071
  resObj.dataBind();
12048
- var resValue = resObj.dataSource[0][resourceCollection[i + 1].idField];
12072
+ var resValue = (resObj.dataSource.length > 0) ?
12073
+ resObj.dataSource[0][resourceCollection[i + 1].idField] : null;
12049
12074
  resObj.value = (resourceCollection[i + 1].allowMultiple) ? [resValue] : resValue;
12050
12075
  resObj.dataBind();
12051
12076
  }
@@ -13436,7 +13461,9 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
13436
13461
  };
13437
13462
  VirtualScroll.prototype.renderEvents = function () {
13438
13463
  this.setTabIndex();
13439
- this.parent.refreshEvents(false);
13464
+ if (this.parent.crudModule) {
13465
+ this.parent.crudModule.refreshProcessedData(true);
13466
+ }
13440
13467
  if (this.parent.currentView !== 'Month') {
13441
13468
  this.parent.notify(contentReady, {});
13442
13469
  }
@@ -14103,7 +14130,8 @@ var Crud = /** @__PURE__ @class */ (function () {
14103
14130
  }
14104
14131
  this.parent.trigger(actionFailure, { error: e }, function () { return _this.parent.hideSpinner(); });
14105
14132
  };
14106
- Crud.prototype.refreshProcessedData = function () {
14133
+ Crud.prototype.refreshProcessedData = function (isVirtualScrollAction) {
14134
+ if (isVirtualScrollAction === void 0) { isVirtualScrollAction = false; }
14107
14135
  if (this.parent.dragAndDropModule) {
14108
14136
  this.parent.dragAndDropModule.actionObj.action = '';
14109
14137
  removeClass([this.parent.element], 'e-event-action');
@@ -14123,6 +14151,10 @@ var Crud = /** @__PURE__ @class */ (function () {
14123
14151
  }
14124
14152
  this.parent.resetTemplates(templateNames);
14125
14153
  }
14154
+ if (isVirtualScrollAction) {
14155
+ this.parent.notify(dataReady, { processedData: this.parent.eventsProcessed });
14156
+ return;
14157
+ }
14126
14158
  var eventsData = this.parent.eventsData || [];
14127
14159
  var blockData = this.parent.blockData || [];
14128
14160
  var data = eventsData.concat(blockData);
@@ -18393,11 +18425,11 @@ var Schedule = /** @__PURE__ @class */ (function (_super) {
18393
18425
  */
18394
18426
  Schedule.prototype.refreshEvents = function (isRemoteRefresh) {
18395
18427
  if (isRemoteRefresh === void 0) { isRemoteRefresh = true; }
18396
- if (this.dragAndDropModule) {
18397
- this.dragAndDropModule.actionObj.action = '';
18398
- removeClass([this.element], EVENT_ACTION_CLASS);
18399
- }
18400
18428
  if (isRemoteRefresh) {
18429
+ if (this.dragAndDropModule) {
18430
+ this.dragAndDropModule.actionObj.action = '';
18431
+ removeClass([this.element], EVENT_ACTION_CLASS);
18432
+ }
18401
18433
  this.crudModule.refreshDataManager();
18402
18434
  }
18403
18435
  else {
@@ -26842,9 +26874,9 @@ var ICalendarImport = /** @__PURE__ @class */ (function () {
26842
26874
  }
26843
26875
  });
26844
26876
  var app = extend([], events, null, true);
26845
- this.parent.addEvent(this.processOccurrence(app));
26877
+ this.parent.addEvent(this.processOccurrence(app, id));
26846
26878
  };
26847
- ICalendarImport.prototype.processOccurrence = function (app) {
26879
+ ICalendarImport.prototype.processOccurrence = function (app, maxId) {
26848
26880
  var _this = this;
26849
26881
  var appoint = [];
26850
26882
  var uId = 'UID';
@@ -26864,31 +26896,49 @@ var ICalendarImport = /** @__PURE__ @class */ (function () {
26864
26896
  if (appointmentIds.indexOf(eventObj[fields.id]) < 0) {
26865
26897
  var data = app.filter(function (data) { return data.UID === eventObj[uId]; });
26866
26898
  if (data.length > 1 && isNullOrUndefined(eventObj[fields.recurrenceID])) {
26899
+ id = typeof (maxId) === 'number' ? maxId++ : id;
26867
26900
  for (var i = 0; i < data.length; i++) {
26868
26901
  // eslint-disable-next-line no-prototype-builtins
26869
26902
  if (data[i].hasOwnProperty(fields.recurrenceID)) {
26870
26903
  var exdate = data[i][fields.recurrenceID];
26871
- data[i][fields.id] = _this.parent.eventBase.generateGuid();
26904
+ data[i][fields.id] = typeof (maxId) === 'number' ? maxId++ : _this.parent.eventBase.generateGuid();
26872
26905
  data[i][fields.recurrenceID] = id;
26873
26906
  data[i][fields.recurrenceException] = null;
26874
- parentObj[fields.recurrenceException] = (isNullOrUndefined(parentObj[fields.recurrenceException])) ?
26875
- exdate : parentObj[fields.recurrenceException] + ',' + exdate;
26907
+ parentObj[fields.recurrenceException] =
26908
+ _this.getExcludeDateString(parentObj[fields.recurrenceException], exdate);
26876
26909
  delete data[i][uId];
26877
26910
  appoint.push(data[i]);
26878
26911
  }
26879
26912
  }
26880
26913
  delete parentObj[uId];
26914
+ parentObj[fields.id] = id;
26881
26915
  appoint.push(parentObj);
26882
26916
  // eslint-disable-next-line no-prototype-builtins
26883
26917
  }
26884
26918
  else if (!eventObj.hasOwnProperty(fields.recurrenceID)) {
26885
26919
  delete eventObj[uId];
26920
+ eventObj[fields.id] = typeof (maxId) === 'number' ? maxId++ : id;
26886
26921
  appoint.push(eventObj);
26887
26922
  }
26888
26923
  }
26889
26924
  });
26890
26925
  return appoint;
26891
26926
  };
26927
+ ICalendarImport.prototype.getExcludeDateString = function (parentException, occurrenceException) {
26928
+ if (isNullOrUndefined(parentException)) {
26929
+ return occurrenceException;
26930
+ }
26931
+ else if (isNullOrUndefined(occurrenceException)) {
26932
+ return parentException;
26933
+ }
26934
+ var parentExDate = parentException.split(',').map(function (x) { return x.split('T')[0]; });
26935
+ var childExDate = occurrenceException.split(',').map(function (x) { return x.split('T')[0]; });
26936
+ var exDate = parentExDate.filter(function (x) { return childExDate.indexOf(x) > -1; });
26937
+ if (exDate.length > 0) {
26938
+ return parentException;
26939
+ }
26940
+ return parentException + ',' + occurrenceException;
26941
+ };
26892
26942
  ICalendarImport.prototype.getDateString = function (value) {
26893
26943
  value = value || '';
26894
26944
  // eslint-disable-next-line no-useless-escape