@syncfusion/ej2-schedule 31.1.21 → 31.2.2

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
  });
@@ -11527,6 +11530,7 @@ var EventTooltip = /** @__PURE__ @class */ (function () {
11527
11530
  }
11528
11531
  var record = this.parent.eventBase.getEventByGuid(args.target.getAttribute('data-guid'));
11529
11532
  if (isNullOrUndefined(record)) {
11533
+ this.setContent('No Title');
11530
11534
  return;
11531
11535
  }
11532
11536
  if (!isNullOrUndefined(this.parent.eventSettings.tooltipTemplate)) {
@@ -14932,7 +14936,13 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
14932
14936
  };
14933
14937
  VirtualScroll.prototype.setItemSize = function () {
14934
14938
  if (this.isHorizontalScroll) {
14935
- this.itemSize = getElementWidthFromClass(this.parent.activeView.element, WORK_CELLS_CLASS, this.parent.uiStateValues.isTransformed) || this.itemSize;
14939
+ if (this.parent.group.byDate) {
14940
+ var colElement = this.parent.element.querySelector('.' + DATE_HEADER_WRAP_CLASS + ' table col');
14941
+ this.itemSize = colElement ? getElementWidth(colElement, this.parent.uiStateValues.isTransformed) : this.itemSize;
14942
+ }
14943
+ else {
14944
+ this.itemSize = getElementWidthFromClass(this.parent.activeView.element, WORK_CELLS_CLASS, this.parent.uiStateValues.isTransformed) || this.itemSize;
14945
+ }
14936
14946
  }
14937
14947
  else {
14938
14948
  this.itemSize = this.parent.getElementHeightFromClass(this.parent.activeView.element, WORK_CELLS_CLASS) || this.itemSize;
@@ -15292,17 +15302,19 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
15292
15302
  append(contentRows, conWrap.querySelector('tbody'));
15293
15303
  };
15294
15304
  VirtualScroll.prototype.updateOtherViewContent = function (conWrap, resCollection, renderedRows) {
15305
+ var _this = this;
15295
15306
  var tbody = conWrap.querySelector('tbody');
15296
15307
  var colGroup = conWrap.querySelector('colgroup');
15297
15308
  var thead = conWrap.querySelector('thead');
15298
15309
  var table = conWrap.querySelector('table');
15299
15310
  this.parent.activeView.colLevels[this.parent.activeView.colLevels.length - 1] = resCollection;
15300
- var newGroupIndices = new Set(resCollection.map(function (data) { return data.groupIndex; }));
15311
+ var newIndices = this.parent.activeViewOptions.group.byDate
15312
+ ? new Set(resCollection.map(function (data) { return data.date.getTime(); }))
15313
+ : new Set(resCollection.map(function (data) { return data.groupIndex; }));
15301
15314
  renderedRows.forEach(function (row) {
15302
- var tdElements = row.querySelectorAll('td');
15315
+ var tdElements = Array.from(row.querySelectorAll('td'));
15303
15316
  tdElements.forEach(function (td) {
15304
- var groupIndex = parseInt(td.getAttribute('data-group-index'), 10);
15305
- if (!newGroupIndices.has(groupIndex)) {
15317
+ if (!newIndices.has(_this.getIdentifier(td))) {
15306
15318
  td.remove();
15307
15319
  }
15308
15320
  });
@@ -15324,7 +15336,15 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
15324
15336
  var contentRows = this.parent.activeView.getContentRows();
15325
15337
  this.mergeNewTdData(tbody, contentRows);
15326
15338
  };
15339
+ VirtualScroll.prototype.getIdentifier = function (td) {
15340
+ if (this.parent.activeViewOptions.group.byDate) {
15341
+ var date = new Date(parseInt(td.getAttribute('data-date'), 10));
15342
+ return resetTime(date).getTime();
15343
+ }
15344
+ return parseInt(td.getAttribute('data-group-index'), 10);
15345
+ };
15327
15346
  VirtualScroll.prototype.mergeNewTdData = function (tbody, contentRows) {
15347
+ var _this = this;
15328
15348
  var existingRows = Array.from(tbody.querySelectorAll('tr'));
15329
15349
  existingRows.forEach(function (existingRow, rowIndex) {
15330
15350
  if (rowIndex < contentRows.length) {
@@ -15332,12 +15352,10 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
15332
15352
  var existingTds_1 = Array.from(existingRow.querySelectorAll('td'));
15333
15353
  var newTds = Array.from(newRow.querySelectorAll('td'));
15334
15354
  newTds.forEach(function (newTd) {
15335
- var newGroupIndex = parseInt(newTd.getAttribute('data-group-index').toString(), 10);
15336
15355
  var inserted = false;
15337
15356
  for (var _i = 0, existingTds_2 = existingTds_1; _i < existingTds_2.length; _i++) {
15338
15357
  var existingTd = existingTds_2[_i];
15339
- var existingGroupIndex = parseInt(existingTd.getAttribute('data-group-index').toString(), 10);
15340
- if (newGroupIndex < existingGroupIndex) {
15358
+ if (_this.getIdentifier(newTd) < _this.getIdentifier(existingTd)) {
15341
15359
  existingRow.insertBefore(newTd, existingTd);
15342
15360
  inserted = true;
15343
15361
  break;
@@ -23240,7 +23258,8 @@ var YearEvent = /** @__PURE__ @class */ (function (_super) {
23240
23258
  var app = appointments_1[_i];
23241
23259
  var appStart = new Date(app[this.fields.startTime].getTime());
23242
23260
  var appEnd = new Date(app[this.fields.endTime].getTime());
23243
- var timeCondition = app[this.fields.isAllDay] ? resetTime(appEnd).getTime() > dateStart :
23261
+ var timeCondition = app[this.fields.isAllDay] ? (resetTime(appEnd).getTime() > dateStart ||
23262
+ (resetTime(appEnd).getTime() === dateStart && appEnd.getTime() !== resetTime(appEnd).getTime())) :
23244
23263
  resetTime(appEnd).getTime() >= dateStart;
23245
23264
  if (((resetTime(appStart).getTime() <= dateStart) && (timeCondition)) ||
23246
23265
  (resetTime(appStart).getTime() >= dateStart) && (resetTime(appEnd).getTime() <= dateEnd)) {
@@ -25324,14 +25343,26 @@ var ViewBase = /** @__PURE__ @class */ (function () {
25324
25343
  this.parent.resourceBase.expandedResources = this.colLevels[this.colLevels.length - 1];
25325
25344
  }
25326
25345
  };
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; });
25346
+ ViewBase.prototype.getCollection = function (dataCollection) {
25347
+ if (this.parent.virtualScrollModule && this.parent.activeViewOptions.group.resources.length > 0 &&
25348
+ !this.parent.uiStateValues.isGroupAdaptive && (dataCollection ||
25349
+ this.parent.virtualScrollModule.existingDataCollection.length > 0)) {
25350
+ return isNullOrUndefined(dataCollection) ? this.parent.virtualScrollModule.existingDataCollection : dataCollection;
25333
25351
  }
25334
- return groupIndices;
25352
+ return [];
25353
+ };
25354
+ ViewBase.prototype.getGroupIndices = function (dataCollection) {
25355
+ return this.getCollection(dataCollection).map(function (data) { return data.groupIndex; });
25356
+ };
25357
+ ViewBase.prototype.getRenderedDate = function (dataCollection) {
25358
+ var processedDates = [];
25359
+ this.getCollection(dataCollection).forEach(function (tdData) {
25360
+ var date = tdData.date.getTime();
25361
+ if (processedDates.indexOf(date) === -1) {
25362
+ processedDates.push(date);
25363
+ }
25364
+ });
25365
+ return processedDates;
25335
25366
  };
25336
25367
  ViewBase.prototype.destroy = function () {
25337
25368
  if (this.element && this.element.parentNode) {
@@ -26028,16 +26059,18 @@ var VerticalView = /** @__PURE__ @class */ (function (_super) {
26028
26059
  var rows = [];
26029
26060
  var tr = createElement('tr');
26030
26061
  var td = createElement('td');
26031
- var existingGroupIndices = this.getGroupIndices();
26062
+ var existingIndices = [];
26063
+ if (this.parent.virtualScrollModule && this.parent.activeViewOptions.group.resources.length > 0) {
26064
+ existingIndices = this.parent.activeViewOptions.group.byDate ? this.getRenderedDate() : this.getGroupIndices();
26065
+ }
26032
26066
  var handler = function (r) {
26033
26067
  var ntr = tr.cloneNode();
26034
26068
  for (var _i = 0, _a = _this.colLevels[_this.colLevels.length - 1]; _i < _a.length; _i++) {
26035
26069
  var tdData = _a[_i];
26036
26070
  var isAllowTdCreation = true;
26037
26071
  if (_this.parent.virtualScrollModule && _this.parent.activeViewOptions.group.resources.length > 0) {
26038
- if (existingGroupIndices.indexOf(tdData.groupIndex) > -1) {
26039
- isAllowTdCreation = false;
26040
- }
26072
+ var index = _this.parent.activeViewOptions.group.byDate ? tdData.date.getTime() : tdData.groupIndex;
26073
+ isAllowTdCreation = existingIndices.indexOf(index) < 0;
26041
26074
  }
26042
26075
  if (isAllowTdCreation) {
26043
26076
  var ntd = _this.createContentTd(tdData, r, td);