@syncfusion/ej2-gantt 19.4.55 → 19.4.56

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.
@@ -4279,7 +4279,19 @@ class GanttChart {
4279
4279
  //empty row height
4280
4280
  const emptydivHeight = 36;
4281
4281
  const emptyHeight = this.parent.contentHeight === 0 ? this.parent.flatData.length > 1 ? emptydivHeight : 0 : this.parent.contentHeight;
4282
- this.chartBodyContent.style.height = formatUnit(emptyHeight);
4282
+ let contentElement = this.parent.element.getElementsByClassName('e-chart-scroll-container e-content')[0];
4283
+ if (emptyHeight >= contentElement['offsetHeight']) {
4284
+ this.chartBodyContent.style.height = formatUnit(emptyHeight);
4285
+ }
4286
+ else {
4287
+ let scrollHeight = this.parent.element.getElementsByClassName('e-chart-rows-container')[0]['offsetHeight'];
4288
+ if (contentElement['offsetHeight'] >= scrollHeight) {
4289
+ this.chartBodyContent.style.height = contentElement['offsetHeight'] - 17 + 'px';
4290
+ }
4291
+ else {
4292
+ this.chartBodyContent.style.height = contentElement['offsetHeight'] + 'px';
4293
+ }
4294
+ }
4283
4295
  //let element: HTMLElement = this.chartTimelineContainer.querySelector('.' + cls.timelineHeaderTableContainer);
4284
4296
  this.chartBodyContent.style.width = formatUnit(this.parent.timelineModule.totalTimelineWidth);
4285
4297
  this.setVirtualHeight();
@@ -4312,7 +4324,21 @@ class GanttChart {
4312
4324
  if (this.chartBodyContent.clientHeight < this.chartBodyContainer.clientHeight) {
4313
4325
  if (lastRow) {
4314
4326
  addClass(lastRow.querySelectorAll('td'), 'e-lastrow');
4315
- this.chartBodyContent.style.height = formatUnit(this.parent.contentHeight + 1);
4327
+ const emptydivHeight = 36;
4328
+ const emptyHeight = this.parent.contentHeight === 0 ? this.parent.flatData.length > 1 ? emptydivHeight : 0 : this.parent.contentHeight;
4329
+ let contentElement = this.parent.element.getElementsByClassName('e-chart-scroll-container e-content')[0];
4330
+ if (emptyHeight >= contentElement['offsetHeight']) {
4331
+ this.chartBodyContent.style.height = formatUnit(emptyHeight);
4332
+ }
4333
+ else {
4334
+ let scrollHeight = this.parent.element.getElementsByClassName('e-chart-rows-container')[0]['offsetHeight'];
4335
+ if (contentElement['offsetHeight'] >= scrollHeight) {
4336
+ this.chartBodyContent.style.height = contentElement['offsetHeight'] - 17 + 'px';
4337
+ }
4338
+ else {
4339
+ this.chartBodyContent.style.height = contentElement['offsetHeight'] + 'px';
4340
+ }
4341
+ }
4316
4342
  }
4317
4343
  }
4318
4344
  }
@@ -5356,7 +5382,7 @@ class Timeline {
5356
5382
  const currentZoomingLevel = this.checkCurrentZoomingLevel();
5357
5383
  this.isZoomIn = isZoomIn;
5358
5384
  this.isZooming = true;
5359
- const currentLevel = isZoomIn ? currentZoomingLevel + 1 : currentZoomingLevel - 1;
5385
+ let currentLevel = isZoomIn ? currentZoomingLevel + 1 : currentZoomingLevel - 1;
5360
5386
  if (this.parent.toolbarModule) {
5361
5387
  if (isZoomIn) {
5362
5388
  if (currentLevel === this.parent.zoomingLevels[this.parent.zoomingLevels.length - 1].level) {
@@ -5375,6 +5401,9 @@ class Timeline {
5375
5401
  }
5376
5402
  }
5377
5403
  }
5404
+ currentLevel = this.parent.zoomingLevels.findIndex((tempLevel) => {
5405
+ return tempLevel.level === currentLevel;
5406
+ });
5378
5407
  let newTimeline = this.parent.zoomingLevels[currentLevel];
5379
5408
  const args = {
5380
5409
  requestType: isZoomIn ? 'beforeZoomIn' : 'beforeZoomOut',
@@ -12328,25 +12357,7 @@ let Gantt = class Gantt extends Component {
12328
12357
  * @returns {void} .
12329
12358
  */
12330
12359
  calculateDimensions() {
12331
- let settingsHeight;
12332
- if (typeof (this.height) !== 'number' && this.height.indexOf('%') !== -1 && (this.element.parentElement &&
12333
- !this.element.parentElement.style.height || this.element.parentElement.style.height.indexOf('%') !== -1)) {
12334
- let ganttHeight;
12335
- if (this.element.parentElement.style.height.indexOf('%') == -1) {
12336
- ganttHeight = Number(this.height.split("%")[0]);
12337
- }
12338
- else {
12339
- ganttHeight = Number(this.element.parentElement.style.height.split("%")[0]);
12340
- }
12341
- ganttHeight = (ganttHeight * window.innerHeight) / 100;
12342
- if (this.height === '100%') {
12343
- ganttHeight = ganttHeight - 16;
12344
- }
12345
- settingsHeight = this.validateDimentionValue(ganttHeight);
12346
- }
12347
- else {
12348
- settingsHeight = this.validateDimentionValue(this.height);
12349
- }
12360
+ let settingsHeight = this.validateDimentionValue(this.height);
12350
12361
  let settingsWidth = this.validateDimentionValue(this.width);
12351
12362
  if (!isNullOrUndefined(this.width) && typeof (this.width) === 'string' && this.width.indexOf('%') !== -1) {
12352
12363
  settingsWidth = this.width;
@@ -12489,40 +12500,6 @@ let Gantt = class Gantt extends Component {
12489
12500
  */
12490
12501
  windowResize() {
12491
12502
  if (!isNullOrUndefined(this.element)) {
12492
- let settingsHeight;
12493
- if (this.height.indexOf('%') !== -1) {
12494
- let ganttHeight = Number(this.height.split("%")[0]);
12495
- if (this.element.parentElement && (this.element.parentElement.style.height)) {
12496
- let containerHeight;
12497
- if (this.element.parentElement.style.height.indexOf('%') == -1) {
12498
- containerHeight = Number(this.element.parentElement.style.height.split("px")[0]);
12499
- ganttHeight = (ganttHeight * containerHeight) / 100;
12500
- }
12501
- else {
12502
- containerHeight = Number(this.element.parentElement.style.height.split("%")[0]);
12503
- ganttHeight = (window.innerHeight * containerHeight) / 100;
12504
- }
12505
- }
12506
- else {
12507
- ganttHeight = Number(this.height.split("%")[0]);
12508
- ganttHeight = (ganttHeight * window.innerHeight) / 100;
12509
- }
12510
- if (this.height === '100%') {
12511
- ganttHeight = ganttHeight - 16;
12512
- }
12513
- let toolbarHeight = 0;
12514
- if (!isNullOrUndefined(this.toolbarModule) && !isNullOrUndefined(this.toolbarModule.element)) {
12515
- toolbarHeight = this.toolbarModule.element.offsetHeight;
12516
- }
12517
- let contentHeight = ganttHeight - this.ganttChartModule.chartTimelineContainer.offsetHeight - toolbarHeight;
12518
- settingsHeight = this.validateDimentionValue(ganttHeight);
12519
- this.element.style.height = settingsHeight;
12520
- this.element.querySelectorAll('.e-content')[0]['style'].height = contentHeight + 'px';
12521
- this.element.querySelectorAll('.e-content')[2]['style'].height = contentHeight + 'px';
12522
- }
12523
- else {
12524
- settingsHeight = this.validateDimentionValue(this.height);
12525
- }
12526
12503
  this.updateContentHeight();
12527
12504
  this.ganttChartModule.updateWidthAndHeight(); // Updating chart scroll conatiner height for row mismatch
12528
12505
  this.treeGridModule.ensureScrollBar();
@@ -12867,6 +12844,18 @@ let Gantt = class Gantt extends Component {
12867
12844
  * @private
12868
12845
  */
12869
12846
  treeDataBound(args) {
12847
+ this.element.getElementsByClassName('e-chart-root-container')[0]['style'].height = '100%';
12848
+ let gridHeight = this.element.getElementsByClassName('e-gridcontent')[0]['style'].height;
12849
+ let timelineContainer = this.element.getElementsByClassName('e-timeline-header-container')[0]['offsetHeight'];
12850
+ gridHeight = 'calc(100% - ' + timelineContainer + 'px)';
12851
+ // eslint-disable-next-line
12852
+ this.element.getElementsByClassName('e-chart-scroll-container e-content')[0]['style'].height = 'calc(100% - ' + timelineContainer + 'px)';
12853
+ if (!isNullOrUndefined(this.toolbarModule)) {
12854
+ this.splitterElement.style.height = 'calc(100% - ' + this.toolbarModule.element.offsetHeight + 'px)';
12855
+ }
12856
+ else {
12857
+ this.splitterElement.style.height = '100%';
12858
+ }
12870
12859
  if (this.isLoad) {
12871
12860
  this.updateCurrentViewData();
12872
12861
  if (!this.enableVirtualization) {
@@ -12886,8 +12875,7 @@ let Gantt = class Gantt extends Component {
12886
12875
  removeClass(this.treeGrid.element.querySelectorAll('.e-headercell'), timelineSingleHeaderOuterDiv);
12887
12876
  removeClass(this.treeGrid.element.querySelectorAll('.e-columnheader'), timelineSingleHeaderOuterDiv);
12888
12877
  }
12889
- this.treeGrid.height = this.ganttHeight - toolbarHeight -
12890
- this.treeGrid.grid.getHeaderContent().offsetHeight;
12878
+ this.treeGrid.height = '100%';
12891
12879
  this.notify('tree-grid-created', {});
12892
12880
  this.createGanttPopUpElement();
12893
12881
  this.hideSpinner();
@@ -23195,23 +23183,22 @@ class Edit$2 {
23195
23183
  }
23196
23184
  /* data Source update */
23197
23185
  if (!isNullOrUndefined(parentItem)) {
23198
- childIndex = parentItem.childRecords.indexOf(this.addRowSelectedItem);
23199
- /*Child collection update*/
23186
+ if (rowPosition == 'Above') {
23187
+ childIndex = parentItem.childRecords.indexOf(this.addRowSelectedItem);
23188
+ }
23189
+ else if (rowPosition == 'Below') {
23190
+ childIndex = parentItem.childRecords.indexOf(this.addRowSelectedItem) + 1;
23191
+ }
23192
+ else {
23193
+ childIndex = parentItem.childRecords.length;
23194
+ } /*Child collection update*/
23200
23195
  parentItem.childRecords.splice(childIndex, 0, record);
23201
23196
  if ((this.parent.dataSource instanceof DataManager &&
23202
23197
  isNullOrUndefined(parentItem.taskData[this.parent.taskFields.parentID])) ||
23203
23198
  !isNullOrUndefined(this.parent.dataSource)) {
23204
23199
  const child = this.parent.taskFields.child;
23205
23200
  if (parentItem.taskData[child] && parentItem.taskData[child].length > 0) {
23206
- if (rowPosition === 'Above') {
23207
- parentItem.taskData[child].splice(childIndex, 0, record.taskData);
23208
- }
23209
- else if (rowPosition === 'Below') {
23210
- parentItem.taskData[child].splice(childIndex + 1, 0, record.taskData);
23211
- }
23212
- else {
23213
- parentItem.taskData[child].push(record.taskData);
23214
- }
23201
+ parentItem.taskData[child].splice(childIndex, 0, record.taskData);
23215
23202
  }
23216
23203
  else {
23217
23204
  parentItem.taskData[child] = [];
@@ -23276,9 +23263,21 @@ class Edit$2 {
23276
23263
  refreshRecordInImmutableMode() {
23277
23264
  for (let i = 0; i < this.parent.modifiedRecords.length; i++) {
23278
23265
  const originalData = this.parent.modifiedRecords[i];
23279
- const dataId = this.parent.viewType === 'ProjectView' ?
23280
- originalData.ganttProperties.taskId : originalData.ganttProperties.rowUniqueID;
23281
- this.parent.treeGrid.grid.setRowData(dataId, originalData);
23266
+ let treeIndex = this.parent.allowRowDragAndDrop ? 1 : 0;
23267
+ let uniqueTaskID = this.parent.taskFields.id;
23268
+ var originalIndex = this.parent.currentViewData.findIndex((data) => {
23269
+ return (data[uniqueTaskID] == originalData[uniqueTaskID]);
23270
+ });
23271
+ if (this.parent.treeGrid.getRows()[originalIndex]) {
23272
+ this.parent.treeGrid.renderModule.cellRender({
23273
+ data: originalData, cell: this.parent.treeGrid.getRows()[originalIndex].cells[this.parent.treeColumnIndex + treeIndex],
23274
+ column: this.parent.treeGrid.grid.getColumns()[this.parent.treeColumnIndex],
23275
+ requestType: 'rowDragAndDrop'
23276
+ });
23277
+ this.parent.treeGrid.renderModule.RowModifier({
23278
+ data: originalData, row: this.parent.treeGrid.getRows()[originalIndex], rowHeight: this.parent.rowHeight
23279
+ });
23280
+ }
23282
23281
  }
23283
23282
  }
23284
23283
  /**
@@ -24029,15 +24028,18 @@ class Edit$2 {
24029
24028
  if (this.dropPosition === 'topSegment' || this.dropPosition === 'bottomSegment') {
24030
24029
  draggedRec[this.parent.taskFields.parentID] = droppedRec[this.parent.taskFields.parentID];
24031
24030
  draggedRec.taskData[this.parent.taskFields.parentID] = droppedRec[this.parent.taskFields.parentID];
24031
+ draggedRec.ganttProperties['parentId'] = droppedRec[this.parent.taskFields.parentID];
24032
24032
  }
24033
24033
  else {
24034
24034
  draggedRec[this.parent.taskFields.parentID] = droppedRec[this.parent.taskFields.id];
24035
24035
  draggedRec.taskData[this.parent.taskFields.parentID] = droppedRec[this.parent.taskFields.id];
24036
+ draggedRec.ganttProperties['parentId'] = droppedRec[this.parent.taskFields.id];
24036
24037
  }
24037
24038
  }
24038
24039
  else {
24039
24040
  draggedRec[this.parent.taskFields.parentID] = null;
24040
24041
  draggedRec.taskData[this.parent.taskFields.parentID] = null;
24042
+ draggedRec.ganttProperties['parentId'] = null;
24041
24043
  }
24042
24044
  }
24043
24045
  }
@@ -24889,8 +24891,9 @@ class Selection$1 {
24889
24891
  }
24890
24892
  this.addRemoveClass(index);
24891
24893
  this.selectedRowIndexes = extend([], this.getSelectedRowIndexes(), [], true);
24892
- if (this.selectedRowIndexes.length == 0) {
24893
- this.parent.setProperties({ selectedRowIndex: -1 }, true);
24894
+ this.parent.setProperties({ selectedRowIndex: -1 }, true);
24895
+ if (this.selectedRowIndexes.length === 1) {
24896
+ this.parent.setProperties({ selectedRowIndex: this.selectedRowIndexes[0] }, true);
24894
24897
  }
24895
24898
  if (!isNullOrUndefined(this.parent.toolbarModule)) {
24896
24899
  this.parent.toolbarModule.refreshToolbarItems();