@syncfusion/ej2-schedule 20.3.50 → 20.3.56

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.
@@ -365,9 +365,6 @@ var scrollWidth = null;
365
365
  * @private
366
366
  */
367
367
  function getScrollBarWidth() {
368
- if (scrollWidth !== null) {
369
- return scrollWidth;
370
- }
371
368
  var divNode = createElement('div');
372
369
  var value = 0;
373
370
  divNode.style.cssText = 'width:100px;height: 100px;overflow: scroll;position: absolute;top: -9999px;';
@@ -1613,8 +1610,8 @@ var ScheduleTouch = /** @__PURE__ @class */ (function () {
1613
1610
  }
1614
1611
  ScheduleTouch.prototype.scrollHandler = function (e) {
1615
1612
  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)))) {
1613
+ (e.originalEvent && e.originalEvent.target && (e.originalEvent.target.classList.contains(APPOINTMENT_CLASS) ||
1614
+ closest(e.originalEvent.target, '.' + APPOINTMENT_CLASS)) && !this.parent.isAdaptive)) {
1618
1615
  return;
1619
1616
  }
1620
1617
  if (!this.timeStampStart) {
@@ -1850,6 +1847,7 @@ var KeyboardInteraction = /** @__PURE__ @class */ (function () {
1850
1847
  enter: 'enter',
1851
1848
  escape: 'escape',
1852
1849
  delete: 'delete',
1850
+ backspace: 'backspace',
1853
1851
  home: 'home',
1854
1852
  pageUp: 'pageup',
1855
1853
  pageDown: 'pagedown',
@@ -1921,6 +1919,7 @@ var KeyboardInteraction = /** @__PURE__ @class */ (function () {
1921
1919
  this.processTab(e, e.shiftKey);
1922
1920
  break;
1923
1921
  case 'delete':
1922
+ case 'backspace':
1924
1923
  this.processDelete(e);
1925
1924
  break;
1926
1925
  case 'ctrlShiftUpArrow':
@@ -3072,9 +3071,11 @@ var Gregorian = /** @__PURE__ @class */ (function () {
3072
3071
  }
3073
3072
  };
3074
3073
  Gregorian.prototype.setMonth = function (date, interval, startDate) {
3074
+ date.setDate(1);
3075
3075
  date.setFullYear(date.getFullYear());
3076
3076
  date.setMonth(interval - 1);
3077
- date.setDate(startDate);
3077
+ var maxDay = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
3078
+ date.setDate(Math.min(startDate, maxDay));
3078
3079
  };
3079
3080
  Gregorian.prototype.addYears = function (date, interval) {
3080
3081
  date.setFullYear(date.getFullYear() + interval);
@@ -6019,7 +6020,8 @@ var EventBase = /** @__PURE__ @class */ (function () {
6019
6020
  }
6020
6021
  if (idType === 'number') {
6021
6022
  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]; }));
6023
+ var appIds = datas.map(function (event) { return event[_this.parent.eventFields.id]; });
6024
+ var maxId = appIds.reduce(function (a, b) { return Math.max(a, b); });
6023
6025
  maxId = isNullOrUndefined(resourceId) ? maxId : maxId + resourceId;
6024
6026
  eventId = maxId + 1;
6025
6027
  }
@@ -8187,7 +8189,13 @@ var TimelineEvent = /** @__PURE__ @class */ (function (_super) {
8187
8189
  eventObj[this.fields.endTime] = eventData[this.fields.endTime];
8188
8190
  var currentDate = resetTime(new Date(this.dateRender[this.day].getTime()));
8189
8191
  var schedule = getStartEndHours(currentDate, this.startHour, this.endHour);
8190
- var isValidEvent = this.isValidEvent(eventObj, startTime, endTime, schedule);
8192
+ var isValidEvent = true;
8193
+ if (this.isDayProcess() || eventObj[this.fields.isAllDay]) {
8194
+ isValidEvent = true;
8195
+ }
8196
+ else {
8197
+ isValidEvent = this.isValidEvent(eventObj, startTime, endTime, schedule);
8198
+ }
8191
8199
  if (startTime <= endTime && isValidEvent) {
8192
8200
  var appWidth_1 = this.getEventWidth(startTime, endTime, event[this.fields.isAllDay], diffInDays);
8193
8201
  appWidth_1 = this.renderType === 'day' ? appWidth_1 - 2 : appWidth_1;
@@ -8350,14 +8358,19 @@ var TimelineEvent = /** @__PURE__ @class */ (function (_super) {
8350
8358
  TimelineEvent.prototype.getStartTime = function (event, eventData) {
8351
8359
  var startTime = event[this.fields.startTime];
8352
8360
  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);
8361
+ if (this.isDayProcess()) {
8362
+ startTime = event[this.fields.startTime];
8358
8363
  }
8359
8364
  else {
8360
- startTime = eventData[this.fields.startTime];
8365
+ if (schedule.startHour.getTime() >= eventData[this.fields.startTime]) {
8366
+ startTime = schedule.startHour;
8367
+ }
8368
+ else if (schedule.endHour.getTime() <= eventData[this.fields.startTime]) {
8369
+ startTime = this.getNextDay(schedule.startHour, eventData);
8370
+ }
8371
+ else {
8372
+ startTime = eventData[this.fields.startTime];
8373
+ }
8361
8374
  }
8362
8375
  // To overcome the overflow
8363
8376
  eventData.trimStartTime = (event[this.fields.isAllDay]) ? schedule.startHour : eventData[this.fields.startTime];
@@ -8377,17 +8390,15 @@ var TimelineEvent = /** @__PURE__ @class */ (function (_super) {
8377
8390
  TimelineEvent.prototype.getEndTime = function (event, eventData) {
8378
8391
  var endTime = event[this.fields.endTime];
8379
8392
  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')) {
8393
+ if (this.isDayProcess()) {
8383
8394
  endTime = eventData[this.fields.endTime];
8384
8395
  }
8385
8396
  else {
8386
8397
  endTime = eventData[this.fields.endTime];
8387
- if (schedule.endHour.getTime() <= eventData[this.fields.endTime]) {
8398
+ if (schedule.endHour.getTime() <= eventData[this.fields.endTime] || event[this.fields.isAllDay]) {
8388
8399
  endTime = schedule.endHour;
8389
8400
  }
8390
- if (schedule.startHour.getTime() >= eventData[this.fields.endTime].getTime() && !event.isAllDay) {
8401
+ if (schedule.startHour.getTime() >= eventData[this.fields.endTime].getTime() && !event[this.fields.isAllDay]) {
8391
8402
  endTime = this.getPreviousDay(schedule.startHour, schedule.endHour, eventData);
8392
8403
  }
8393
8404
  }
@@ -8540,6 +8551,14 @@ var TimelineEvent = /** @__PURE__ @class */ (function (_super) {
8540
8551
  'height': (this.cellHeight - (this.maxHeight ? 0 : EVENT_GAP$1) - (this.maxHeight ? 0 : this.moreIndicatorHeight)) + 'px'
8541
8552
  });
8542
8553
  };
8554
+ TimelineEvent.prototype.isDayProcess = function () {
8555
+ if (this.parent.currentView === 'TimelineMonth' || !this.parent.activeViewOptions.timeScale.enable ||
8556
+ (this.parent.activeViewOptions.headerRows.length > 0 &&
8557
+ this.parent.activeViewOptions.headerRows.slice(-1)[0].option !== 'Hour')) {
8558
+ return true;
8559
+ }
8560
+ return false;
8561
+ };
8543
8562
  TimelineEvent.prototype.destroy = function () {
8544
8563
  this.renderType = null;
8545
8564
  this.eventContainers = null;
@@ -8615,21 +8634,27 @@ var InlineEdit = /** @__PURE__ @class */ (function () {
8615
8634
  }
8616
8635
  else {
8617
8636
  var subEle = args.element.querySelector('.' + SUBJECT_CLASS);
8618
- var timeEle = args.element.querySelector('.' + APPOINTMENT_TIME);
8619
- subject = subEle.innerText;
8637
+ if (!isNullOrUndefined(subEle)) {
8638
+ addClass([subEle], DISABLE_CLASS);
8639
+ subject = subEle.innerText;
8640
+ }
8641
+ else {
8642
+ subject = args.data[this.parent.eventFields.subject];
8643
+ }
8620
8644
  inlineSubject = createElement('input', { className: INLINE_SUBJECT_CLASS, attrs: { value: subject } });
8621
- addClass([subEle], DISABLE_CLASS);
8622
8645
  if (closest(args.element, '.' + MORE_POPUP_WRAPPER_CLASS)) {
8623
8646
  args.element.insertBefore(inlineSubject, subEle);
8624
8647
  }
8625
8648
  else if (['Agenda', 'MonthAgenda'].indexOf(this.parent.currentView) > -1) {
8626
8649
  var subjectWrap = args.element.querySelector('.' + SUBJECT_WRAP);
8650
+ if (isNullOrUndefined(subjectWrap)) {
8651
+ subjectWrap = createElement('div', { className: SUBJECT_WRAP });
8652
+ args.element.prepend(subjectWrap);
8653
+ }
8627
8654
  subjectWrap.insertBefore(inlineSubject, subjectWrap.firstChild);
8628
8655
  }
8629
8656
  else {
8630
- var elementSelector = ['TimelineDay', 'TimelineWeek', 'TimelineWorkWeek', 'TimelineMonth'].indexOf(this.parent.currentView) > -1 ?
8631
- '.e-inner-wrap' : '.e-appointment-details';
8632
- args.element.querySelector(elementSelector).insertBefore(inlineSubject, timeEle);
8657
+ args.element.querySelector('.e-appointment-details').prepend(inlineSubject);
8633
8658
  }
8634
8659
  inlineSubject.focus();
8635
8660
  }
@@ -8771,7 +8796,10 @@ var InlineEdit = /** @__PURE__ @class */ (function () {
8771
8796
  var inlineSubject = this.parent.element.querySelector('.' + INLINE_SUBJECT_CLASS);
8772
8797
  if (inlineSubject) {
8773
8798
  var appointmentSubject = closest(inlineSubject, '.' + APPOINTMENT_CLASS);
8774
- removeClass([appointmentSubject.querySelector('.' + SUBJECT_CLASS)], DISABLE_CLASS);
8799
+ var subject = appointmentSubject.querySelector('.' + SUBJECT_CLASS);
8800
+ if (!isNullOrUndefined(subject)) {
8801
+ removeClass([subject], DISABLE_CLASS);
8802
+ }
8775
8803
  remove(inlineSubject);
8776
8804
  }
8777
8805
  };
@@ -12014,7 +12042,8 @@ var EventWindow = /** @__PURE__ @class */ (function () {
12014
12042
  var filter = resourceModel.dataSource.filter(function (data) {
12015
12043
  return data[resourceModel.groupIDField] === args.value[j];
12016
12044
  })[0];
12017
- var groupId = filter[resourceCollection[i + 1].groupIDField];
12045
+ var groupId = (!isNullOrUndefined(filter)) ?
12046
+ filter[resourceCollection[i + 1].groupIDField] : null;
12018
12047
  var filterRes = this_1.filterDatasource(i, groupId);
12019
12048
  datasource = datasource.concat(filterRes);
12020
12049
  };
@@ -12031,6 +12060,7 @@ var EventWindow = /** @__PURE__ @class */ (function () {
12031
12060
  var resourceData = this.parent.resourceBase.resourceCollection[index + 1];
12032
12061
  var resObject = this.element.querySelector('.e-' + resourceData.field).
12033
12062
  ej2_instances[0];
12063
+ resObject.clear();
12034
12064
  return resObject;
12035
12065
  };
12036
12066
  EventWindow.prototype.onDropdownResourceChange = function (args) {
@@ -12045,7 +12075,8 @@ var EventWindow = /** @__PURE__ @class */ (function () {
12045
12075
  var groupId = args.itemData[resourceCollection[i].idField];
12046
12076
  resObj.dataSource = this.filterDatasource(i, groupId);
12047
12077
  resObj.dataBind();
12048
- var resValue = resObj.dataSource[0][resourceCollection[i + 1].idField];
12078
+ var resValue = (resObj.dataSource.length > 0) ?
12079
+ resObj.dataSource[0][resourceCollection[i + 1].idField] : null;
12049
12080
  resObj.value = (resourceCollection[i + 1].allowMultiple) ? [resValue] : resValue;
12050
12081
  resObj.dataBind();
12051
12082
  }
@@ -13436,7 +13467,9 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
13436
13467
  };
13437
13468
  VirtualScroll.prototype.renderEvents = function () {
13438
13469
  this.setTabIndex();
13439
- this.parent.refreshEvents(false);
13470
+ if (this.parent.crudModule) {
13471
+ this.parent.crudModule.refreshProcessedData(true);
13472
+ }
13440
13473
  if (this.parent.currentView !== 'Month') {
13441
13474
  this.parent.notify(contentReady, {});
13442
13475
  }
@@ -14103,7 +14136,8 @@ var Crud = /** @__PURE__ @class */ (function () {
14103
14136
  }
14104
14137
  this.parent.trigger(actionFailure, { error: e }, function () { return _this.parent.hideSpinner(); });
14105
14138
  };
14106
- Crud.prototype.refreshProcessedData = function () {
14139
+ Crud.prototype.refreshProcessedData = function (isVirtualScrollAction) {
14140
+ if (isVirtualScrollAction === void 0) { isVirtualScrollAction = false; }
14107
14141
  if (this.parent.dragAndDropModule) {
14108
14142
  this.parent.dragAndDropModule.actionObj.action = '';
14109
14143
  removeClass([this.parent.element], 'e-event-action');
@@ -14123,6 +14157,10 @@ var Crud = /** @__PURE__ @class */ (function () {
14123
14157
  }
14124
14158
  this.parent.resetTemplates(templateNames);
14125
14159
  }
14160
+ if (isVirtualScrollAction) {
14161
+ this.parent.notify(dataReady, { processedData: this.parent.eventsProcessed });
14162
+ return;
14163
+ }
14126
14164
  var eventsData = this.parent.eventsData || [];
14127
14165
  var blockData = this.parent.blockData || [];
14128
14166
  var data = eventsData.concat(blockData);
@@ -18393,11 +18431,11 @@ var Schedule = /** @__PURE__ @class */ (function (_super) {
18393
18431
  */
18394
18432
  Schedule.prototype.refreshEvents = function (isRemoteRefresh) {
18395
18433
  if (isRemoteRefresh === void 0) { isRemoteRefresh = true; }
18396
- if (this.dragAndDropModule) {
18397
- this.dragAndDropModule.actionObj.action = '';
18398
- removeClass([this.element], EVENT_ACTION_CLASS);
18399
- }
18400
18434
  if (isRemoteRefresh) {
18435
+ if (this.dragAndDropModule) {
18436
+ this.dragAndDropModule.actionObj.action = '';
18437
+ removeClass([this.element], EVENT_ACTION_CLASS);
18438
+ }
18401
18439
  this.crudModule.refreshDataManager();
18402
18440
  }
18403
18441
  else {
@@ -26842,9 +26880,9 @@ var ICalendarImport = /** @__PURE__ @class */ (function () {
26842
26880
  }
26843
26881
  });
26844
26882
  var app = extend([], events, null, true);
26845
- this.parent.addEvent(this.processOccurrence(app));
26883
+ this.parent.addEvent(this.processOccurrence(app, id));
26846
26884
  };
26847
- ICalendarImport.prototype.processOccurrence = function (app) {
26885
+ ICalendarImport.prototype.processOccurrence = function (app, maxId) {
26848
26886
  var _this = this;
26849
26887
  var appoint = [];
26850
26888
  var uId = 'UID';
@@ -26864,31 +26902,49 @@ var ICalendarImport = /** @__PURE__ @class */ (function () {
26864
26902
  if (appointmentIds.indexOf(eventObj[fields.id]) < 0) {
26865
26903
  var data = app.filter(function (data) { return data.UID === eventObj[uId]; });
26866
26904
  if (data.length > 1 && isNullOrUndefined(eventObj[fields.recurrenceID])) {
26905
+ id = typeof (maxId) === 'number' ? maxId++ : id;
26867
26906
  for (var i = 0; i < data.length; i++) {
26868
26907
  // eslint-disable-next-line no-prototype-builtins
26869
26908
  if (data[i].hasOwnProperty(fields.recurrenceID)) {
26870
26909
  var exdate = data[i][fields.recurrenceID];
26871
- data[i][fields.id] = _this.parent.eventBase.generateGuid();
26910
+ data[i][fields.id] = typeof (maxId) === 'number' ? maxId++ : _this.parent.eventBase.generateGuid();
26872
26911
  data[i][fields.recurrenceID] = id;
26873
26912
  data[i][fields.recurrenceException] = null;
26874
- parentObj[fields.recurrenceException] = (isNullOrUndefined(parentObj[fields.recurrenceException])) ?
26875
- exdate : parentObj[fields.recurrenceException] + ',' + exdate;
26913
+ parentObj[fields.recurrenceException] =
26914
+ _this.getExcludeDateString(parentObj[fields.recurrenceException], exdate);
26876
26915
  delete data[i][uId];
26877
26916
  appoint.push(data[i]);
26878
26917
  }
26879
26918
  }
26880
26919
  delete parentObj[uId];
26920
+ parentObj[fields.id] = id;
26881
26921
  appoint.push(parentObj);
26882
26922
  // eslint-disable-next-line no-prototype-builtins
26883
26923
  }
26884
26924
  else if (!eventObj.hasOwnProperty(fields.recurrenceID)) {
26885
26925
  delete eventObj[uId];
26926
+ eventObj[fields.id] = typeof (maxId) === 'number' ? maxId++ : id;
26886
26927
  appoint.push(eventObj);
26887
26928
  }
26888
26929
  }
26889
26930
  });
26890
26931
  return appoint;
26891
26932
  };
26933
+ ICalendarImport.prototype.getExcludeDateString = function (parentException, occurrenceException) {
26934
+ if (isNullOrUndefined(parentException)) {
26935
+ return occurrenceException;
26936
+ }
26937
+ else if (isNullOrUndefined(occurrenceException)) {
26938
+ return parentException;
26939
+ }
26940
+ var parentExDate = parentException.split(',').map(function (x) { return x.split('T')[0]; });
26941
+ var childExDate = occurrenceException.split(',').map(function (x) { return x.split('T')[0]; });
26942
+ var exDate = parentExDate.filter(function (x) { return childExDate.indexOf(x) > -1; });
26943
+ if (exDate.length > 0) {
26944
+ return parentException;
26945
+ }
26946
+ return parentException + ',' + occurrenceException;
26947
+ };
26892
26948
  ICalendarImport.prototype.getDateString = function (value) {
26893
26949
  value = value || '';
26894
26950
  // eslint-disable-next-line no-useless-escape