@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.
@@ -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
  });
@@ -7896,23 +7899,28 @@ class VerticalEvent extends EventBase {
7896
7899
  }
7897
7900
  const queue = [];
7898
7901
  this.overlapList.forEach((obj) => {
7899
- queue.push(obj);
7900
7902
  let filterList = [];
7901
7903
  const processedIds = new Set();
7904
+ queue.push(obj);
7905
+ processedIds.add(obj[fieldMapping.id]);
7906
+ filterList.push(obj);
7902
7907
  while (queue.length > 0) {
7903
7908
  const currentObj = queue.shift();
7904
- const overlaps = appointmentList.filter((data) => {
7905
- return data[fieldMapping.endTime] > currentObj[fieldMapping.startTime] &&
7906
- data[fieldMapping.startTime] <= currentObj[fieldMapping.endTime] &&
7907
- !processedIds.has(data[fieldMapping.id]);
7908
- });
7909
- overlaps.forEach((overlap) => {
7910
- filterList.push(overlap);
7911
- processedIds.add(overlap[fieldMapping.id]);
7912
- queue.push(overlap);
7913
- });
7914
- if (processedIds.size < appointmentList.length - 1) {
7915
- break;
7909
+ const currentObjEndTime = currentObj[fieldMapping.endTime].getTime();
7910
+ const currentObjStartTime = currentObj[fieldMapping.startTime].getTime();
7911
+ for (const data of appointmentList) {
7912
+ const dataStartTime = data[fieldMapping.startTime].getTime();
7913
+ const dataEndTime = data[fieldMapping.endTime].getTime();
7914
+ if (dataStartTime >= currentObjEndTime) {
7915
+ break;
7916
+ }
7917
+ if (!processedIds.has(data[fieldMapping.id])) {
7918
+ if (dataEndTime > currentObjStartTime && dataStartTime < currentObjEndTime) {
7919
+ filterList.push(data);
7920
+ processedIds.add(data[fieldMapping.id]);
7921
+ queue.push(data);
7922
+ }
7923
+ }
7916
7924
  }
7917
7925
  }
7918
7926
  if (this.parent.activeViewOptions.group.resources.length > 0) {
@@ -11249,6 +11257,7 @@ class EventTooltip {
11249
11257
  }
11250
11258
  const record = this.parent.eventBase.getEventByGuid(args.target.getAttribute('data-guid'));
11251
11259
  if (isNullOrUndefined(record)) {
11260
+ this.setContent('No Title');
11252
11261
  return;
11253
11262
  }
11254
11263
  if (!isNullOrUndefined(this.parent.eventSettings.tooltipTemplate)) {
@@ -14580,7 +14589,13 @@ class VirtualScroll {
14580
14589
  }
14581
14590
  setItemSize() {
14582
14591
  if (this.isHorizontalScroll) {
14583
- this.itemSize = getElementWidthFromClass(this.parent.activeView.element, WORK_CELLS_CLASS, this.parent.uiStateValues.isTransformed) || this.itemSize;
14592
+ if (this.parent.group.byDate) {
14593
+ const colElement = this.parent.element.querySelector('.' + DATE_HEADER_WRAP_CLASS + ' table col');
14594
+ this.itemSize = colElement ? getElementWidth(colElement, this.parent.uiStateValues.isTransformed) : this.itemSize;
14595
+ }
14596
+ else {
14597
+ this.itemSize = getElementWidthFromClass(this.parent.activeView.element, WORK_CELLS_CLASS, this.parent.uiStateValues.isTransformed) || this.itemSize;
14598
+ }
14584
14599
  }
14585
14600
  else {
14586
14601
  this.itemSize = this.parent.getElementHeightFromClass(this.parent.activeView.element, WORK_CELLS_CLASS) || this.itemSize;
@@ -14938,12 +14953,13 @@ class VirtualScroll {
14938
14953
  const thead = conWrap.querySelector('thead');
14939
14954
  const table = conWrap.querySelector('table');
14940
14955
  this.parent.activeView.colLevels[this.parent.activeView.colLevels.length - 1] = resCollection;
14941
- const newGroupIndices = new Set(resCollection.map((data) => data.groupIndex));
14956
+ const newIndices = this.parent.activeViewOptions.group.byDate
14957
+ ? new Set(resCollection.map((data) => data.date.getTime()))
14958
+ : new Set(resCollection.map((data) => data.groupIndex));
14942
14959
  renderedRows.forEach((row) => {
14943
- const tdElements = row.querySelectorAll('td');
14960
+ const tdElements = Array.from(row.querySelectorAll('td'));
14944
14961
  tdElements.forEach((td) => {
14945
- const groupIndex = parseInt(td.getAttribute('data-group-index'), 10);
14946
- if (!newGroupIndices.has(groupIndex)) {
14962
+ if (!newIndices.has(this.getIdentifier(td))) {
14947
14963
  td.remove();
14948
14964
  }
14949
14965
  });
@@ -14965,6 +14981,13 @@ class VirtualScroll {
14965
14981
  const contentRows = this.parent.activeView.getContentRows();
14966
14982
  this.mergeNewTdData(tbody, contentRows);
14967
14983
  }
14984
+ getIdentifier(td) {
14985
+ if (this.parent.activeViewOptions.group.byDate) {
14986
+ const date = new Date(parseInt(td.getAttribute('data-date'), 10));
14987
+ return resetTime(date).getTime();
14988
+ }
14989
+ return parseInt(td.getAttribute('data-group-index'), 10);
14990
+ }
14968
14991
  mergeNewTdData(tbody, contentRows) {
14969
14992
  const existingRows = Array.from(tbody.querySelectorAll('tr'));
14970
14993
  existingRows.forEach((existingRow, rowIndex) => {
@@ -14973,11 +14996,9 @@ class VirtualScroll {
14973
14996
  const existingTds = Array.from(existingRow.querySelectorAll('td'));
14974
14997
  const newTds = Array.from(newRow.querySelectorAll('td'));
14975
14998
  newTds.forEach((newTd) => {
14976
- const newGroupIndex = parseInt(newTd.getAttribute('data-group-index').toString(), 10);
14977
14999
  let inserted = false;
14978
15000
  for (const existingTd of existingTds) {
14979
- const existingGroupIndex = parseInt(existingTd.getAttribute('data-group-index').toString(), 10);
14980
- if (newGroupIndex < existingGroupIndex) {
15001
+ if (this.getIdentifier(newTd) < this.getIdentifier(existingTd)) {
14981
15002
  existingRow.insertBefore(newTd, existingTd);
14982
15003
  inserted = true;
14983
15004
  break;
@@ -22443,7 +22464,8 @@ class YearEvent extends TimelineEvent {
22443
22464
  for (const app of appointments) {
22444
22465
  const appStart = new Date(app[this.fields.startTime].getTime());
22445
22466
  const appEnd = new Date(app[this.fields.endTime].getTime());
22446
- const timeCondition = app[this.fields.isAllDay] ? resetTime(appEnd).getTime() > dateStart :
22467
+ const timeCondition = app[this.fields.isAllDay] ? (resetTime(appEnd).getTime() > dateStart ||
22468
+ (resetTime(appEnd).getTime() === dateStart && appEnd.getTime() !== resetTime(appEnd).getTime())) :
22447
22469
  resetTime(appEnd).getTime() >= dateStart;
22448
22470
  if (((resetTime(appStart).getTime() <= dateStart) && (timeCondition)) ||
22449
22471
  (resetTime(appStart).getTime() >= dateStart) && (resetTime(appEnd).getTime() <= dateEnd)) {
@@ -24483,14 +24505,26 @@ class ViewBase {
24483
24505
  this.parent.resourceBase.expandedResources = this.colLevels[this.colLevels.length - 1];
24484
24506
  }
24485
24507
  }
24486
- getGroupIndices(dataCollection) {
24487
- let groupIndices = [];
24488
- if (this.parent.virtualScrollModule && this.parent.activeViewOptions.group.resources.length > 0 && (dataCollection ||
24489
- this.parent.virtualScrollModule.existingDataCollection.length > 0) && !this.parent.uiStateValues.isGroupAdaptive) {
24490
- dataCollection = isNullOrUndefined(dataCollection) ? this.parent.virtualScrollModule.existingDataCollection : dataCollection;
24491
- groupIndices = dataCollection.map((data) => data.groupIndex);
24508
+ getCollection(dataCollection) {
24509
+ if (this.parent.virtualScrollModule && this.parent.activeViewOptions.group.resources.length > 0 &&
24510
+ !this.parent.uiStateValues.isGroupAdaptive && (dataCollection ||
24511
+ this.parent.virtualScrollModule.existingDataCollection.length > 0)) {
24512
+ return isNullOrUndefined(dataCollection) ? this.parent.virtualScrollModule.existingDataCollection : dataCollection;
24492
24513
  }
24493
- return groupIndices;
24514
+ return [];
24515
+ }
24516
+ getGroupIndices(dataCollection) {
24517
+ return this.getCollection(dataCollection).map((data) => data.groupIndex);
24518
+ }
24519
+ getRenderedDate(dataCollection) {
24520
+ const processedDates = [];
24521
+ this.getCollection(dataCollection).forEach((tdData) => {
24522
+ const date = tdData.date.getTime();
24523
+ if (processedDates.indexOf(date) === -1) {
24524
+ processedDates.push(date);
24525
+ }
24526
+ });
24527
+ return processedDates;
24494
24528
  }
24495
24529
  destroy() {
24496
24530
  if (this.element && this.element.parentNode) {
@@ -25160,15 +25194,17 @@ class VerticalView extends ViewBase {
25160
25194
  const rows = [];
25161
25195
  const tr = createElement('tr');
25162
25196
  const td = createElement('td');
25163
- const existingGroupIndices = this.getGroupIndices();
25197
+ let existingIndices = [];
25198
+ if (this.parent.virtualScrollModule && this.parent.activeViewOptions.group.resources.length > 0) {
25199
+ existingIndices = this.parent.activeViewOptions.group.byDate ? this.getRenderedDate() : this.getGroupIndices();
25200
+ }
25164
25201
  const handler = (r) => {
25165
25202
  const ntr = tr.cloneNode();
25166
25203
  for (const tdData of this.colLevels[this.colLevels.length - 1]) {
25167
25204
  let isAllowTdCreation = true;
25168
25205
  if (this.parent.virtualScrollModule && this.parent.activeViewOptions.group.resources.length > 0) {
25169
- if (existingGroupIndices.indexOf(tdData.groupIndex) > -1) {
25170
- isAllowTdCreation = false;
25171
- }
25206
+ const index = this.parent.activeViewOptions.group.byDate ? tdData.date.getTime() : tdData.groupIndex;
25207
+ isAllowTdCreation = existingIndices.indexOf(index) < 0;
25172
25208
  }
25173
25209
  if (isAllowTdCreation) {
25174
25210
  const ntd = this.createContentTd(tdData, r, td);