@syncfusion/ej2-schedule 31.1.21 → 31.2.3

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.
@@ -6832,8 +6832,11 @@ var EventBase = /** @__PURE__ @class */ (function () {
6832
6832
  })[0];
6833
6833
  };
6834
6834
  EventBase.prototype.generateGuid = function () {
6835
+ var randomNumbers = new Uint8Array(32);
6836
+ window.crypto.getRandomValues(randomNumbers);
6837
+ var index = 0;
6835
6838
  return 'xyxxxxyx-xxxy-yxxx-xyxx-xxyxxxxyyxxx'.replace(/[xy]/g, function (c) {
6836
- var r = Math.random() * 16 | 0;
6839
+ var r = randomNumbers[index++] & 0xf;
6837
6840
  var v = (c === 'x') ? r : (r & 0x3 | 0x8);
6838
6841
  return v.toString(16);
6839
6842
  });
@@ -8081,29 +8084,30 @@ var VerticalEvent = /** @__PURE__ @class */ (function (_super) {
8081
8084
  }
8082
8085
  var queue_1 = [];
8083
8086
  this.overlapList.forEach(function (obj) {
8084
- queue_1.push(obj);
8085
8087
  var filterList = [];
8086
8088
  var processedIds = new Set();
8087
- var _loop_2 = function () {
8089
+ queue_1.push(obj);
8090
+ processedIds.add(obj[fieldMapping.id]);
8091
+ filterList.push(obj);
8092
+ while (queue_1.length > 0) {
8088
8093
  var currentObj = queue_1.shift();
8089
- var overlaps = appointmentList_1.filter(function (data) {
8090
- return data[fieldMapping.endTime] > currentObj[fieldMapping.startTime] &&
8091
- data[fieldMapping.startTime] <= currentObj[fieldMapping.endTime] &&
8092
- !processedIds.has(data[fieldMapping.id]);
8093
- });
8094
- overlaps.forEach(function (overlap) {
8095
- filterList.push(overlap);
8096
- processedIds.add(overlap[fieldMapping.id]);
8097
- queue_1.push(overlap);
8098
- });
8099
- if (processedIds.size < appointmentList_1.length - 1) {
8100
- return "break";
8094
+ var currentObjEndTime = currentObj[fieldMapping.endTime].getTime();
8095
+ var currentObjStartTime = currentObj[fieldMapping.startTime].getTime();
8096
+ for (var _i = 0, appointmentList_2 = appointmentList_1; _i < appointmentList_2.length; _i++) {
8097
+ var data = appointmentList_2[_i];
8098
+ var dataStartTime = data[fieldMapping.startTime].getTime();
8099
+ var dataEndTime = data[fieldMapping.endTime].getTime();
8100
+ if (dataStartTime >= currentObjEndTime) {
8101
+ break;
8102
+ }
8103
+ if (!processedIds.has(data[fieldMapping.id])) {
8104
+ if (dataEndTime > currentObjStartTime && dataStartTime < currentObjEndTime) {
8105
+ filterList.push(data);
8106
+ processedIds.add(data[fieldMapping.id]);
8107
+ queue_1.push(data);
8108
+ }
8109
+ }
8101
8110
  }
8102
- };
8103
- while (queue_1.length > 0) {
8104
- var state_1 = _loop_2();
8105
- if (state_1 === "break")
8106
- break;
8107
8111
  }
8108
8112
  if (_this.parent.activeViewOptions.group.resources.length > 0) {
8109
8113
  filterList = _this.filterEventsByResource(_this.resources[parseInt(resource.toString(), 10)], filterList);
@@ -11527,6 +11531,7 @@ var EventTooltip = /** @__PURE__ @class */ (function () {
11527
11531
  }
11528
11532
  var record = this.parent.eventBase.getEventByGuid(args.target.getAttribute('data-guid'));
11529
11533
  if (isNullOrUndefined(record)) {
11534
+ this.setContent('No Title');
11530
11535
  return;
11531
11536
  }
11532
11537
  if (!isNullOrUndefined(this.parent.eventSettings.tooltipTemplate)) {
@@ -14932,7 +14937,13 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
14932
14937
  };
14933
14938
  VirtualScroll.prototype.setItemSize = function () {
14934
14939
  if (this.isHorizontalScroll) {
14935
- this.itemSize = getElementWidthFromClass(this.parent.activeView.element, WORK_CELLS_CLASS, this.parent.uiStateValues.isTransformed) || this.itemSize;
14940
+ if (this.parent.group.byDate) {
14941
+ var colElement = this.parent.element.querySelector('.' + DATE_HEADER_WRAP_CLASS + ' table col');
14942
+ this.itemSize = colElement ? getElementWidth(colElement, this.parent.uiStateValues.isTransformed) : this.itemSize;
14943
+ }
14944
+ else {
14945
+ this.itemSize = getElementWidthFromClass(this.parent.activeView.element, WORK_CELLS_CLASS, this.parent.uiStateValues.isTransformed) || this.itemSize;
14946
+ }
14936
14947
  }
14937
14948
  else {
14938
14949
  this.itemSize = this.parent.getElementHeightFromClass(this.parent.activeView.element, WORK_CELLS_CLASS) || this.itemSize;
@@ -15292,17 +15303,19 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
15292
15303
  append(contentRows, conWrap.querySelector('tbody'));
15293
15304
  };
15294
15305
  VirtualScroll.prototype.updateOtherViewContent = function (conWrap, resCollection, renderedRows) {
15306
+ var _this = this;
15295
15307
  var tbody = conWrap.querySelector('tbody');
15296
15308
  var colGroup = conWrap.querySelector('colgroup');
15297
15309
  var thead = conWrap.querySelector('thead');
15298
15310
  var table = conWrap.querySelector('table');
15299
15311
  this.parent.activeView.colLevels[this.parent.activeView.colLevels.length - 1] = resCollection;
15300
- var newGroupIndices = new Set(resCollection.map(function (data) { return data.groupIndex; }));
15312
+ var newIndices = this.parent.activeViewOptions.group.byDate
15313
+ ? new Set(resCollection.map(function (data) { return data.date.getTime(); }))
15314
+ : new Set(resCollection.map(function (data) { return data.groupIndex; }));
15301
15315
  renderedRows.forEach(function (row) {
15302
- var tdElements = row.querySelectorAll('td');
15316
+ var tdElements = Array.from(row.querySelectorAll('td'));
15303
15317
  tdElements.forEach(function (td) {
15304
- var groupIndex = parseInt(td.getAttribute('data-group-index'), 10);
15305
- if (!newGroupIndices.has(groupIndex)) {
15318
+ if (!newIndices.has(_this.getIdentifier(td))) {
15306
15319
  td.remove();
15307
15320
  }
15308
15321
  });
@@ -15324,7 +15337,15 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
15324
15337
  var contentRows = this.parent.activeView.getContentRows();
15325
15338
  this.mergeNewTdData(tbody, contentRows);
15326
15339
  };
15340
+ VirtualScroll.prototype.getIdentifier = function (td) {
15341
+ if (this.parent.activeViewOptions.group.byDate) {
15342
+ var date = new Date(parseInt(td.getAttribute('data-date'), 10));
15343
+ return resetTime(date).getTime();
15344
+ }
15345
+ return parseInt(td.getAttribute('data-group-index'), 10);
15346
+ };
15327
15347
  VirtualScroll.prototype.mergeNewTdData = function (tbody, contentRows) {
15348
+ var _this = this;
15328
15349
  var existingRows = Array.from(tbody.querySelectorAll('tr'));
15329
15350
  existingRows.forEach(function (existingRow, rowIndex) {
15330
15351
  if (rowIndex < contentRows.length) {
@@ -15332,12 +15353,10 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
15332
15353
  var existingTds_1 = Array.from(existingRow.querySelectorAll('td'));
15333
15354
  var newTds = Array.from(newRow.querySelectorAll('td'));
15334
15355
  newTds.forEach(function (newTd) {
15335
- var newGroupIndex = parseInt(newTd.getAttribute('data-group-index').toString(), 10);
15336
15356
  var inserted = false;
15337
15357
  for (var _i = 0, existingTds_2 = existingTds_1; _i < existingTds_2.length; _i++) {
15338
15358
  var existingTd = existingTds_2[_i];
15339
- var existingGroupIndex = parseInt(existingTd.getAttribute('data-group-index').toString(), 10);
15340
- if (newGroupIndex < existingGroupIndex) {
15359
+ if (_this.getIdentifier(newTd) < _this.getIdentifier(existingTd)) {
15341
15360
  existingRow.insertBefore(newTd, existingTd);
15342
15361
  inserted = true;
15343
15362
  break;
@@ -23240,7 +23259,8 @@ var YearEvent = /** @__PURE__ @class */ (function (_super) {
23240
23259
  var app = appointments_1[_i];
23241
23260
  var appStart = new Date(app[this.fields.startTime].getTime());
23242
23261
  var appEnd = new Date(app[this.fields.endTime].getTime());
23243
- var timeCondition = app[this.fields.isAllDay] ? resetTime(appEnd).getTime() > dateStart :
23262
+ var timeCondition = app[this.fields.isAllDay] ? (resetTime(appEnd).getTime() > dateStart ||
23263
+ (resetTime(appEnd).getTime() === dateStart && appEnd.getTime() !== resetTime(appEnd).getTime())) :
23244
23264
  resetTime(appEnd).getTime() >= dateStart;
23245
23265
  if (((resetTime(appStart).getTime() <= dateStart) && (timeCondition)) ||
23246
23266
  (resetTime(appStart).getTime() >= dateStart) && (resetTime(appEnd).getTime() <= dateEnd)) {
@@ -25324,14 +25344,26 @@ var ViewBase = /** @__PURE__ @class */ (function () {
25324
25344
  this.parent.resourceBase.expandedResources = this.colLevels[this.colLevels.length - 1];
25325
25345
  }
25326
25346
  };
25327
- ViewBase.prototype.getGroupIndices = function (dataCollection) {
25328
- var groupIndices = [];
25329
- if (this.parent.virtualScrollModule && this.parent.activeViewOptions.group.resources.length > 0 && (dataCollection ||
25330
- this.parent.virtualScrollModule.existingDataCollection.length > 0) && !this.parent.uiStateValues.isGroupAdaptive) {
25331
- dataCollection = isNullOrUndefined(dataCollection) ? this.parent.virtualScrollModule.existingDataCollection : dataCollection;
25332
- groupIndices = dataCollection.map(function (data) { return data.groupIndex; });
25347
+ ViewBase.prototype.getCollection = function (dataCollection) {
25348
+ if (this.parent.virtualScrollModule && this.parent.activeViewOptions.group.resources.length > 0 &&
25349
+ !this.parent.uiStateValues.isGroupAdaptive && (dataCollection ||
25350
+ this.parent.virtualScrollModule.existingDataCollection.length > 0)) {
25351
+ return isNullOrUndefined(dataCollection) ? this.parent.virtualScrollModule.existingDataCollection : dataCollection;
25333
25352
  }
25334
- return groupIndices;
25353
+ return [];
25354
+ };
25355
+ ViewBase.prototype.getGroupIndices = function (dataCollection) {
25356
+ return this.getCollection(dataCollection).map(function (data) { return data.groupIndex; });
25357
+ };
25358
+ ViewBase.prototype.getRenderedDate = function (dataCollection) {
25359
+ var processedDates = [];
25360
+ this.getCollection(dataCollection).forEach(function (tdData) {
25361
+ var date = tdData.date.getTime();
25362
+ if (processedDates.indexOf(date) === -1) {
25363
+ processedDates.push(date);
25364
+ }
25365
+ });
25366
+ return processedDates;
25335
25367
  };
25336
25368
  ViewBase.prototype.destroy = function () {
25337
25369
  if (this.element && this.element.parentNode) {
@@ -26028,16 +26060,18 @@ var VerticalView = /** @__PURE__ @class */ (function (_super) {
26028
26060
  var rows = [];
26029
26061
  var tr = createElement('tr');
26030
26062
  var td = createElement('td');
26031
- var existingGroupIndices = this.getGroupIndices();
26063
+ var existingIndices = [];
26064
+ if (this.parent.virtualScrollModule && this.parent.activeViewOptions.group.resources.length > 0) {
26065
+ existingIndices = this.parent.activeViewOptions.group.byDate ? this.getRenderedDate() : this.getGroupIndices();
26066
+ }
26032
26067
  var handler = function (r) {
26033
26068
  var ntr = tr.cloneNode();
26034
26069
  for (var _i = 0, _a = _this.colLevels[_this.colLevels.length - 1]; _i < _a.length; _i++) {
26035
26070
  var tdData = _a[_i];
26036
26071
  var isAllowTdCreation = true;
26037
26072
  if (_this.parent.virtualScrollModule && _this.parent.activeViewOptions.group.resources.length > 0) {
26038
- if (existingGroupIndices.indexOf(tdData.groupIndex) > -1) {
26039
- isAllowTdCreation = false;
26040
- }
26073
+ var index = _this.parent.activeViewOptions.group.byDate ? tdData.date.getTime() : tdData.groupIndex;
26074
+ isAllowTdCreation = existingIndices.indexOf(index) < 0;
26041
26075
  }
26042
26076
  if (isAllowTdCreation) {
26043
26077
  var ntd = _this.createContentTd(tdData, r, td);