@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.
@@ -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)) {
@@ -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;
@@ -14938,12 +14948,13 @@ class VirtualScroll {
14938
14948
  const thead = conWrap.querySelector('thead');
14939
14949
  const table = conWrap.querySelector('table');
14940
14950
  this.parent.activeView.colLevels[this.parent.activeView.colLevels.length - 1] = resCollection;
14941
- 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));
14942
14954
  renderedRows.forEach((row) => {
14943
- const tdElements = row.querySelectorAll('td');
14955
+ const tdElements = Array.from(row.querySelectorAll('td'));
14944
14956
  tdElements.forEach((td) => {
14945
- const groupIndex = parseInt(td.getAttribute('data-group-index'), 10);
14946
- if (!newGroupIndices.has(groupIndex)) {
14957
+ if (!newIndices.has(this.getIdentifier(td))) {
14947
14958
  td.remove();
14948
14959
  }
14949
14960
  });
@@ -14965,6 +14976,13 @@ class VirtualScroll {
14965
14976
  const contentRows = this.parent.activeView.getContentRows();
14966
14977
  this.mergeNewTdData(tbody, contentRows);
14967
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
+ }
14968
14986
  mergeNewTdData(tbody, contentRows) {
14969
14987
  const existingRows = Array.from(tbody.querySelectorAll('tr'));
14970
14988
  existingRows.forEach((existingRow, rowIndex) => {
@@ -14973,11 +14991,9 @@ class VirtualScroll {
14973
14991
  const existingTds = Array.from(existingRow.querySelectorAll('td'));
14974
14992
  const newTds = Array.from(newRow.querySelectorAll('td'));
14975
14993
  newTds.forEach((newTd) => {
14976
- const newGroupIndex = parseInt(newTd.getAttribute('data-group-index').toString(), 10);
14977
14994
  let inserted = false;
14978
14995
  for (const existingTd of existingTds) {
14979
- const existingGroupIndex = parseInt(existingTd.getAttribute('data-group-index').toString(), 10);
14980
- if (newGroupIndex < existingGroupIndex) {
14996
+ if (this.getIdentifier(newTd) < this.getIdentifier(existingTd)) {
14981
14997
  existingRow.insertBefore(newTd, existingTd);
14982
14998
  inserted = true;
14983
14999
  break;
@@ -22443,7 +22459,8 @@ class YearEvent extends TimelineEvent {
22443
22459
  for (const app of appointments) {
22444
22460
  const appStart = new Date(app[this.fields.startTime].getTime());
22445
22461
  const appEnd = new Date(app[this.fields.endTime].getTime());
22446
- 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())) :
22447
22464
  resetTime(appEnd).getTime() >= dateStart;
22448
22465
  if (((resetTime(appStart).getTime() <= dateStart) && (timeCondition)) ||
22449
22466
  (resetTime(appStart).getTime() >= dateStart) && (resetTime(appEnd).getTime() <= dateEnd)) {
@@ -24483,14 +24500,26 @@ class ViewBase {
24483
24500
  this.parent.resourceBase.expandedResources = this.colLevels[this.colLevels.length - 1];
24484
24501
  }
24485
24502
  }
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);
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;
24492
24508
  }
24493
- 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;
24494
24523
  }
24495
24524
  destroy() {
24496
24525
  if (this.element && this.element.parentNode) {
@@ -25160,15 +25189,17 @@ class VerticalView extends ViewBase {
25160
25189
  const rows = [];
25161
25190
  const tr = createElement('tr');
25162
25191
  const td = createElement('td');
25163
- 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
+ }
25164
25196
  const handler = (r) => {
25165
25197
  const ntr = tr.cloneNode();
25166
25198
  for (const tdData of this.colLevels[this.colLevels.length - 1]) {
25167
25199
  let isAllowTdCreation = true;
25168
25200
  if (this.parent.virtualScrollModule && this.parent.activeViewOptions.group.resources.length > 0) {
25169
- if (existingGroupIndices.indexOf(tdData.groupIndex) > -1) {
25170
- isAllowTdCreation = false;
25171
- }
25201
+ const index = this.parent.activeViewOptions.group.byDate ? tdData.date.getTime() : tdData.groupIndex;
25202
+ isAllowTdCreation = existingIndices.indexOf(index) < 0;
25172
25203
  }
25173
25204
  if (isAllowTdCreation) {
25174
25205
  const ntd = this.createContentTd(tdData, r, td);