@syncfusion/ej2-treegrid 19.3.47 → 19.3.57

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.
@@ -2165,7 +2165,9 @@ class DataManipulation {
2165
2165
  const query = getObject('query', args);
2166
2166
  const srtQry = new Query();
2167
2167
  for (let srt = this.parent.grid.sortSettings.columns.length - 1; srt >= 0; srt--) {
2168
- const col = this.parent.grid.getColumnByField(this.parent.grid.sortSettings.columns[srt].field);
2168
+ const getColumnByField = 'getColumnByField';
2169
+ const col = this.parent.grid.renderModule.data[getColumnByField](this.parent.grid.
2170
+ sortSettings.columns[srt].field);
2169
2171
  const compFun = col.sortComparer && isOffline(this.parent) ?
2170
2172
  col.sortComparer.bind(col) :
2171
2173
  this.parent.grid.sortSettings.columns[srt].direction;
@@ -3569,6 +3571,15 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3569
3571
  this.trigger(rowSelecting, args);
3570
3572
  };
3571
3573
  this.grid.rowSelected = (args) => {
3574
+ if (this.enableVirtualization && args.isHeaderCheckboxClicked &&
3575
+ this.grid.currentViewData.length !== this.grid.selectionModule.selectedRowIndexes.length) {
3576
+ const updateRowSelection = 'updateRowSelection';
3577
+ for (let i = 0; i < this.getRows().length; i++) {
3578
+ if (this.getRows()[i].getElementsByClassName("e-frame e-icons e-uncheck").length) {
3579
+ this.grid.selectionModule[updateRowSelection](this.getRows()[i], this.getCurrentViewRecords()[i].index);
3580
+ }
3581
+ }
3582
+ }
3572
3583
  this.selectedRowIndex = this.grid.selectedRowIndex;
3573
3584
  this.notify(rowSelected, args);
3574
3585
  this.trigger(rowSelected, args);
@@ -3871,6 +3882,10 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
3871
3882
  && (this.grid.filterSettings.columns.length === 0 || this.grid.searchSettings.key.length === 0)) {
3872
3883
  this.notify('clearFilters', { flatData: this.grid.dataSource });
3873
3884
  this.grid.setProperties({ dataSource: this.dataResults.result }, true);
3885
+ if (isNullOrUndefined(this.grid['changedProperties'].dataSource)) {
3886
+ this.grid.renderModule.data.dataManager = this.grid.dataSource instanceof DataManager ? this.grid.dataSource :
3887
+ (isNullOrUndefined(this.grid.dataSource) ? new DataManager() : new DataManager(this.grid.dataSource));
3888
+ }
3874
3889
  }
3875
3890
  const callBackPromise = new Deferred();
3876
3891
  this.trigger(actionBegin, args, (actionArgs) => {
@@ -4412,6 +4427,11 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
4412
4427
  if (isNullOrUndefined(this.grid)) {
4413
4428
  return;
4414
4429
  }
4430
+ if (!isNullOrUndefined(this.rowDropSettings.targetID) &&
4431
+ isNullOrUndefined(document.getElementById(this.grid.rowDropSettings.targetID))) {
4432
+ document.getElementById(this.rowDropSettings.targetID).id = this.grid.rowDropSettings.targetID;
4433
+ this.rowDropSettings.targetID = this.grid.rowDropSettings.targetID;
4434
+ }
4415
4435
  super.dataBind();
4416
4436
  this.grid.dataBind();
4417
4437
  }
@@ -5258,7 +5278,7 @@ let TreeGrid = TreeGrid_1 = class TreeGrid extends Component {
5258
5278
  const row = getObject('rows', rec);
5259
5279
  const record = getObject('records', rec);
5260
5280
  for (let i = 0; i < record.length; i++) {
5261
- if (record[i].parentItem !== undefined) {
5281
+ if (!isNullOrUndefined(record[i].parentItem)) {
5262
5282
  const pindex = this.flatData[record[i].parentItem.index].index;
5263
5283
  if (this.flatData[pindex].expanded === false) {
5264
5284
  record.push(this.flatData[pindex]);
@@ -7113,7 +7133,7 @@ class RowDD$1 {
7113
7133
  }
7114
7134
  else {
7115
7135
  if (args.target && closest(args.target, '#' + tObj.rowDropSettings.targetID) || parentsUntil(args.target, 'e-treegrid') &&
7116
- parentsUntil(args.target, 'e-treegrid').id === tObj.rowDropSettings.targetID) {
7136
+ parentsUntil(args.target, 'e-treegrid').id === tObj.rowDropSettings.targetID || args.target && document.getElementById(tObj.rowDropSettings.targetID)) {
7117
7137
  setValue('dropPosition', this.dropPosition, args);
7118
7138
  tObj.trigger(rowDrop, args);
7119
7139
  if (!args.cancel && tObj.rowDropSettings.targetID) {
@@ -10467,13 +10487,23 @@ class Edit$1 {
10467
10487
  }
10468
10488
  if (args.requestType === 'delete') {
10469
10489
  const data = args.data;
10490
+ if (isNullOrUndefined(args.data[0].uniqueID)) {
10491
+ const primaryKeys = this.parent.getPrimaryKeyFieldNames();
10492
+ for (let i = 0; i < data.length; i++) {
10493
+ this.parent.flatData.filter((e) => {
10494
+ if (e[primaryKeys[0]] === args.data[i][primaryKeys[0]]) {
10495
+ data[i] = e;
10496
+ }
10497
+ });
10498
+ }
10499
+ }
10470
10500
  for (let i = 0; i < data.length; i++) {
10471
10501
  this.deleteUniqueID(data[i].uniqueID);
10472
10502
  const childs = findChildrenRecords(data[i]);
10473
10503
  for (let c = 0; c < childs.length; c++) {
10474
10504
  this.deleteUniqueID(childs[c].uniqueID);
10475
10505
  }
10476
- args.data = [...data, ...childs];
10506
+ args.data = [...args.data, ...childs];
10477
10507
  }
10478
10508
  }
10479
10509
  if (args.requestType === 'add' || (this.isAddedRowByMethod && (this.parent.enableVirtualization || this.parent.enableInfiniteScrolling))) {
@@ -10518,6 +10548,7 @@ class Edit$1 {
10518
10548
  }
10519
10549
  if (this.isAddedRowByMethod && args.index !== 0) {
10520
10550
  this.addRowRecord = this.parent.flatData[args.index];
10551
+ this.addRowIndex = args.index;
10521
10552
  }
10522
10553
  if (this.parent.editSettings.newRowPosition === 'Child' && isNullOrUndefined(this.addRowRecord)
10523
10554
  && !isNullOrUndefined(this.parent.getSelectedRecords()[0])) {
@@ -10546,6 +10577,11 @@ class Edit$1 {
10546
10577
  let position = null;
10547
10578
  value.taskData = isNullOrUndefined(value.taskData) ? extend({}, args.data) : value.taskData;
10548
10579
  const currentData = this.parent.grid.getCurrentViewRecords();
10580
+ if (this.parent.enableVirtualization && args.index !== 0) {
10581
+ this.addRowIndex = this.parent.grid.getCurrentViewRecords().indexOf(this.addRowRecord);
10582
+ this.selectedIndex = parseInt(this.parent.getRows()[this.addRowIndex].getAttribute('aria-rowindex'));
10583
+
10584
+ }
10549
10585
  let index = this.addRowIndex;
10550
10586
  value.uniqueID = getUid(this.parent.element.id + '_data_');
10551
10587
  setValue('uniqueIDCollection.' + value.uniqueID, value, this.parent);
@@ -11048,7 +11084,9 @@ class VirtualTreeContentRenderer extends VirtualContentRenderer {
11048
11084
  if (isNullOrUndefined(this.observer[containerRect])) {
11049
11085
  this.observer[containerRect] = this.observers[containerRect];
11050
11086
  }
11051
- super[selectVirtualRow](args);
11087
+ if (args.selectedIndex !== 0 || isNullOrUndefined(this.parent['clipboardModule'].treeGridParent.editModule['addRowIndex'])) {
11088
+ super[selectVirtualRow](args);
11089
+ }
11052
11090
  }
11053
11091
  refreshCell(rowObj) {
11054
11092
  rowObj.cells = this.generateCells();
@@ -11514,6 +11552,11 @@ class VirtualScroll$1 {
11514
11552
  }
11515
11553
  //if ((this.prevendIndex !== -1 && this.prevstartIndex !== -1) &&
11516
11554
  //this.prevendIndex === endIndex && this.prevstartIndex === startIndex) {
11555
+ if (!isNullOrUndefined(this.expandCollapseRec) && (pageingDetails.actionArgs.requestType === 'virtualscroll' ||
11556
+ (pageingDetails.actionArgs.requestType === 'refresh' && startIndex !== this.prevstartIndex)) &&
11557
+ (startIndex < this.parent.getRows().length && endIndex <= startIndex + this.parent.getRows().length)) {
11558
+ startIndex = 0;
11559
+ }
11517
11560
  if (!isNullOrUndefined(this.expandCollapseRec)) {
11518
11561
  const resourceCount = this.parent.getRows();
11519
11562
  let sIndex = visualData.indexOf(this.expandCollapseRec);