@syncfusion/ej2-schedule 31.1.20 → 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.
@@ -6723,8 +6723,11 @@ class EventBase {
6723
6723
  return this.parent.eventsData.filter((data) => data[this.parent.eventFields.id] === id)[0];
6724
6724
  }
6725
6725
  generateGuid() {
6726
+ const randomNumbers = new Uint8Array(32);
6727
+ window.crypto.getRandomValues(randomNumbers);
6728
+ let index = 0;
6726
6729
  return 'xyxxxxyx-xxxy-yxxx-xyxx-xxyxxxxyyxxx'.replace(/[xy]/g, (c) => {
6727
- const r = Math.random() * 16 | 0;
6730
+ const r = randomNumbers[index++] & 0xf;
6728
6731
  const v = (c === 'x') ? r : (r & 0x3 | 0x8);
6729
6732
  return v.toString(16);
6730
6733
  });
@@ -11249,6 +11252,7 @@ class EventTooltip {
11249
11252
  }
11250
11253
  const record = this.parent.eventBase.getEventByGuid(args.target.getAttribute('data-guid'));
11251
11254
  if (isNullOrUndefined(record)) {
11255
+ this.setContent('No Title');
11252
11256
  return;
11253
11257
  }
11254
11258
  if (!isNullOrUndefined(this.parent.eventSettings.tooltipTemplate)) {
@@ -14550,7 +14554,7 @@ class VirtualScroll {
14550
14554
  virtual.style.height = (conTable.offsetHeight + (this.parent.resourceBase.expandedResources.length - (this.renderedLength)) *
14551
14555
  conTable.offsetHeight / this.renderedLength) + 'px';
14552
14556
  const conWrap = this.parent.element.querySelector('.' + CONTENT_WRAP_CLASS);
14553
- if ((conWrap.scrollHeight - conWrap.scrollTop) < conWrap.offsetHeight * this.bufferCount) {
14557
+ if (this.bufferCount === 3 && (conWrap.scrollHeight - conWrap.scrollTop) < conWrap.offsetHeight * this.bufferCount) {
14554
14558
  virtual.style.height = parseInt(virtual.style.height, 10) + (conWrap.offsetHeight * this.bufferCount) + 'px';
14555
14559
  }
14556
14560
  }
@@ -14580,7 +14584,13 @@ class VirtualScroll {
14580
14584
  }
14581
14585
  setItemSize() {
14582
14586
  if (this.isHorizontalScroll) {
14583
- this.itemSize = getElementWidthFromClass(this.parent.activeView.element, WORK_CELLS_CLASS, this.parent.uiStateValues.isTransformed) || this.itemSize;
14587
+ if (this.parent.group.byDate) {
14588
+ const colElement = this.parent.element.querySelector('.' + DATE_HEADER_WRAP_CLASS + ' table col');
14589
+ this.itemSize = colElement ? getElementWidth(colElement, this.parent.uiStateValues.isTransformed) : this.itemSize;
14590
+ }
14591
+ else {
14592
+ this.itemSize = getElementWidthFromClass(this.parent.activeView.element, WORK_CELLS_CLASS, this.parent.uiStateValues.isTransformed) || this.itemSize;
14593
+ }
14584
14594
  }
14585
14595
  else {
14586
14596
  this.itemSize = this.parent.getElementHeightFromClass(this.parent.activeView.element, WORK_CELLS_CLASS) || this.itemSize;
@@ -14734,7 +14744,7 @@ class VirtualScroll {
14734
14744
  index = (index > firstTDIndex) ? firstTDIndex - this.bufferCount : index;
14735
14745
  }
14736
14746
  index = (index > 0) ? index : 0;
14737
- const prevSetCollection = this.getBufferCollection(index, index + this.renderedLength);
14747
+ let prevSetCollection = this.getBufferCollection(index, index + this.renderedLength);
14738
14748
  this.parent.resourceBase.renderedResources = prevSetCollection;
14739
14749
  if (firstTDIndex === 0) {
14740
14750
  this.translateY = conWrap.scrollTop;
@@ -14744,6 +14754,10 @@ class VirtualScroll {
14744
14754
  height = (height > 0) ? height : this.itemSize;
14745
14755
  this.translateY = (conWrap.scrollTop - (this.bufferCount * height) > 0) ?
14746
14756
  conWrap.scrollTop - (this.bufferCount * height) : 0;
14757
+ if (this.parent.rowAutoHeight && this.translateY === 0 && index !== 0) {
14758
+ prevSetCollection = this.getBufferCollection(0, this.renderedLength);
14759
+ this.parent.resourceBase.renderedResources = prevSetCollection;
14760
+ }
14747
14761
  }
14748
14762
  return prevSetCollection;
14749
14763
  }
@@ -14934,12 +14948,13 @@ class VirtualScroll {
14934
14948
  const thead = conWrap.querySelector('thead');
14935
14949
  const table = conWrap.querySelector('table');
14936
14950
  this.parent.activeView.colLevels[this.parent.activeView.colLevels.length - 1] = resCollection;
14937
- const newGroupIndices = new Set(resCollection.map((data) => data.groupIndex));
14951
+ const newIndices = this.parent.activeViewOptions.group.byDate
14952
+ ? new Set(resCollection.map((data) => data.date.getTime()))
14953
+ : new Set(resCollection.map((data) => data.groupIndex));
14938
14954
  renderedRows.forEach((row) => {
14939
- const tdElements = row.querySelectorAll('td');
14955
+ const tdElements = Array.from(row.querySelectorAll('td'));
14940
14956
  tdElements.forEach((td) => {
14941
- const groupIndex = parseInt(td.getAttribute('data-group-index'), 10);
14942
- if (!newGroupIndices.has(groupIndex)) {
14957
+ if (!newIndices.has(this.getIdentifier(td))) {
14943
14958
  td.remove();
14944
14959
  }
14945
14960
  });
@@ -14961,6 +14976,13 @@ class VirtualScroll {
14961
14976
  const contentRows = this.parent.activeView.getContentRows();
14962
14977
  this.mergeNewTdData(tbody, contentRows);
14963
14978
  }
14979
+ getIdentifier(td) {
14980
+ if (this.parent.activeViewOptions.group.byDate) {
14981
+ const date = new Date(parseInt(td.getAttribute('data-date'), 10));
14982
+ return resetTime(date).getTime();
14983
+ }
14984
+ return parseInt(td.getAttribute('data-group-index'), 10);
14985
+ }
14964
14986
  mergeNewTdData(tbody, contentRows) {
14965
14987
  const existingRows = Array.from(tbody.querySelectorAll('tr'));
14966
14988
  existingRows.forEach((existingRow, rowIndex) => {
@@ -14969,11 +14991,9 @@ class VirtualScroll {
14969
14991
  const existingTds = Array.from(existingRow.querySelectorAll('td'));
14970
14992
  const newTds = Array.from(newRow.querySelectorAll('td'));
14971
14993
  newTds.forEach((newTd) => {
14972
- const newGroupIndex = parseInt(newTd.getAttribute('data-group-index').toString(), 10);
14973
14994
  let inserted = false;
14974
14995
  for (const existingTd of existingTds) {
14975
- const existingGroupIndex = parseInt(existingTd.getAttribute('data-group-index').toString(), 10);
14976
- if (newGroupIndex < existingGroupIndex) {
14996
+ if (this.getIdentifier(newTd) < this.getIdentifier(existingTd)) {
14977
14997
  existingRow.insertBefore(newTd, existingTd);
14978
14998
  inserted = true;
14979
14999
  break;
@@ -22439,7 +22459,8 @@ class YearEvent extends TimelineEvent {
22439
22459
  for (const app of appointments) {
22440
22460
  const appStart = new Date(app[this.fields.startTime].getTime());
22441
22461
  const appEnd = new Date(app[this.fields.endTime].getTime());
22442
- const timeCondition = app[this.fields.isAllDay] ? resetTime(appEnd).getTime() > dateStart :
22462
+ const timeCondition = app[this.fields.isAllDay] ? (resetTime(appEnd).getTime() > dateStart ||
22463
+ (resetTime(appEnd).getTime() === dateStart && appEnd.getTime() !== resetTime(appEnd).getTime())) :
22443
22464
  resetTime(appEnd).getTime() >= dateStart;
22444
22465
  if (((resetTime(appStart).getTime() <= dateStart) && (timeCondition)) ||
22445
22466
  (resetTime(appStart).getTime() >= dateStart) && (resetTime(appEnd).getTime() <= dateEnd)) {
@@ -24479,14 +24500,26 @@ class ViewBase {
24479
24500
  this.parent.resourceBase.expandedResources = this.colLevels[this.colLevels.length - 1];
24480
24501
  }
24481
24502
  }
24482
- getGroupIndices(dataCollection) {
24483
- let groupIndices = [];
24484
- if (this.parent.virtualScrollModule && this.parent.activeViewOptions.group.resources.length > 0 && (dataCollection ||
24485
- this.parent.virtualScrollModule.existingDataCollection.length > 0) && !this.parent.uiStateValues.isGroupAdaptive) {
24486
- dataCollection = isNullOrUndefined(dataCollection) ? this.parent.virtualScrollModule.existingDataCollection : dataCollection;
24487
- groupIndices = dataCollection.map((data) => data.groupIndex);
24503
+ getCollection(dataCollection) {
24504
+ if (this.parent.virtualScrollModule && this.parent.activeViewOptions.group.resources.length > 0 &&
24505
+ !this.parent.uiStateValues.isGroupAdaptive && (dataCollection ||
24506
+ this.parent.virtualScrollModule.existingDataCollection.length > 0)) {
24507
+ return isNullOrUndefined(dataCollection) ? this.parent.virtualScrollModule.existingDataCollection : dataCollection;
24488
24508
  }
24489
- return groupIndices;
24509
+ return [];
24510
+ }
24511
+ getGroupIndices(dataCollection) {
24512
+ return this.getCollection(dataCollection).map((data) => data.groupIndex);
24513
+ }
24514
+ getRenderedDate(dataCollection) {
24515
+ const processedDates = [];
24516
+ this.getCollection(dataCollection).forEach((tdData) => {
24517
+ const date = tdData.date.getTime();
24518
+ if (processedDates.indexOf(date) === -1) {
24519
+ processedDates.push(date);
24520
+ }
24521
+ });
24522
+ return processedDates;
24490
24523
  }
24491
24524
  destroy() {
24492
24525
  if (this.element && this.element.parentNode) {
@@ -25156,15 +25189,17 @@ class VerticalView extends ViewBase {
25156
25189
  const rows = [];
25157
25190
  const tr = createElement('tr');
25158
25191
  const td = createElement('td');
25159
- const existingGroupIndices = this.getGroupIndices();
25192
+ let existingIndices = [];
25193
+ if (this.parent.virtualScrollModule && this.parent.activeViewOptions.group.resources.length > 0) {
25194
+ existingIndices = this.parent.activeViewOptions.group.byDate ? this.getRenderedDate() : this.getGroupIndices();
25195
+ }
25160
25196
  const handler = (r) => {
25161
25197
  const ntr = tr.cloneNode();
25162
25198
  for (const tdData of this.colLevels[this.colLevels.length - 1]) {
25163
25199
  let isAllowTdCreation = true;
25164
25200
  if (this.parent.virtualScrollModule && this.parent.activeViewOptions.group.resources.length > 0) {
25165
- if (existingGroupIndices.indexOf(tdData.groupIndex) > -1) {
25166
- isAllowTdCreation = false;
25167
- }
25201
+ const index = this.parent.activeViewOptions.group.byDate ? tdData.date.getTime() : tdData.groupIndex;
25202
+ isAllowTdCreation = existingIndices.indexOf(index) < 0;
25168
25203
  }
25169
25204
  if (isAllowTdCreation) {
25170
25205
  const ntd = this.createContentTd(tdData, r, td);