@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.
@@ -2286,7 +2286,9 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
2286
2286
  var query = getObject('query', args);
2287
2287
  var srtQry = new Query();
2288
2288
  for (var srt = this.parent.grid.sortSettings.columns.length - 1; srt >= 0; srt--) {
2289
- var col = this.parent.grid.getColumnByField(this.parent.grid.sortSettings.columns[srt].field);
2289
+ var getColumnByField = 'getColumnByField';
2290
+ var col = this.parent.grid.renderModule.data[getColumnByField](this.parent.grid.
2291
+ sortSettings.columns[srt].field);
2290
2292
  var compFun = col.sortComparer && isOffline(this.parent) ?
2291
2293
  col.sortComparer.bind(col) :
2292
2294
  this.parent.grid.sortSettings.columns[srt].direction;
@@ -3816,6 +3818,15 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
3816
3818
  _this.trigger(rowSelecting, args);
3817
3819
  };
3818
3820
  this.grid.rowSelected = function (args) {
3821
+ if (_this.enableVirtualization && args.isHeaderCheckboxClicked &&
3822
+ _this.grid.currentViewData.length !== _this.grid.selectionModule.selectedRowIndexes.length) {
3823
+ var updateRowSelection = 'updateRowSelection';
3824
+ for (var i = 0; i < _this.getRows().length; i++) {
3825
+ if (_this.getRows()[i].getElementsByClassName("e-frame e-icons e-uncheck").length) {
3826
+ _this.grid.selectionModule[updateRowSelection](_this.getRows()[i], _this.getCurrentViewRecords()[i].index);
3827
+ }
3828
+ }
3829
+ }
3819
3830
  _this.selectedRowIndex = _this.grid.selectedRowIndex;
3820
3831
  _this.notify(rowSelected, args);
3821
3832
  _this.trigger(rowSelected, args);
@@ -4122,6 +4133,10 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4122
4133
  && (_this.grid.filterSettings.columns.length === 0 || _this.grid.searchSettings.key.length === 0)) {
4123
4134
  _this.notify('clearFilters', { flatData: _this.grid.dataSource });
4124
4135
  _this.grid.setProperties({ dataSource: _this.dataResults.result }, true);
4136
+ if (isNullOrUndefined(_this.grid['changedProperties'].dataSource)) {
4137
+ _this.grid.renderModule.data.dataManager = _this.grid.dataSource instanceof DataManager ? _this.grid.dataSource :
4138
+ (isNullOrUndefined(_this.grid.dataSource) ? new DataManager() : new DataManager(_this.grid.dataSource));
4139
+ }
4125
4140
  }
4126
4141
  var callBackPromise = new Deferred();
4127
4142
  _this.trigger(actionBegin, args, function (actionArgs) {
@@ -4669,6 +4684,11 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4669
4684
  if (isNullOrUndefined(this.grid)) {
4670
4685
  return;
4671
4686
  }
4687
+ if (!isNullOrUndefined(this.rowDropSettings.targetID) &&
4688
+ isNullOrUndefined(document.getElementById(this.grid.rowDropSettings.targetID))) {
4689
+ document.getElementById(this.rowDropSettings.targetID).id = this.grid.rowDropSettings.targetID;
4690
+ this.rowDropSettings.targetID = this.grid.rowDropSettings.targetID;
4691
+ }
4672
4692
  _super.prototype.dataBind.call(this);
4673
4693
  this.grid.dataBind();
4674
4694
  };
@@ -5519,7 +5539,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5519
5539
  var row = getObject('rows', rec);
5520
5540
  var record = getObject('records', rec);
5521
5541
  for (var i = 0; i < record.length; i++) {
5522
- if (record[i].parentItem !== undefined) {
5542
+ if (!isNullOrUndefined(record[i].parentItem)) {
5523
5543
  var pindex = this.flatData[record[i].parentItem.index].index;
5524
5544
  if (this.flatData[pindex].expanded === false) {
5525
5545
  record.push(this.flatData[pindex]);
@@ -7396,7 +7416,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7396
7416
  }
7397
7417
  else {
7398
7418
  if (args.target && closest(args.target, '#' + tObj.rowDropSettings.targetID) || parentsUntil(args.target, 'e-treegrid') &&
7399
- parentsUntil(args.target, 'e-treegrid').id === tObj.rowDropSettings.targetID) {
7419
+ parentsUntil(args.target, 'e-treegrid').id === tObj.rowDropSettings.targetID || args.target && document.getElementById(tObj.rowDropSettings.targetID)) {
7400
7420
  setValue('dropPosition', this.dropPosition, args);
7401
7421
  tObj.trigger(rowDrop, args);
7402
7422
  if (!args.cancel && tObj.rowDropSettings.targetID) {
@@ -10814,14 +10834,28 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
10814
10834
  return;
10815
10835
  }
10816
10836
  if (args.requestType === 'delete') {
10817
- var data = args.data;
10818
- for (var i = 0; i < data.length; i++) {
10819
- this.deleteUniqueID(data[i].uniqueID);
10820
- var childs = findChildrenRecords(data[i]);
10837
+ var data_1 = args.data;
10838
+ if (isNullOrUndefined(args.data[0].uniqueID)) {
10839
+ var primaryKeys_2 = this.parent.getPrimaryKeyFieldNames();
10840
+ var _loop_1 = function (i) {
10841
+ this_1.parent.flatData.filter(function (e) {
10842
+ if (e[primaryKeys_2[0]] === args.data[i][primaryKeys_2[0]]) {
10843
+ data_1[i] = e;
10844
+ }
10845
+ });
10846
+ };
10847
+ var this_1 = this;
10848
+ for (var i = 0; i < data_1.length; i++) {
10849
+ _loop_1(i);
10850
+ }
10851
+ }
10852
+ for (var i = 0; i < data_1.length; i++) {
10853
+ this.deleteUniqueID(data_1[i].uniqueID);
10854
+ var childs = findChildrenRecords(data_1[i]);
10821
10855
  for (var c = 0; c < childs.length; c++) {
10822
10856
  this.deleteUniqueID(childs[c].uniqueID);
10823
10857
  }
10824
- args.data = data.concat(childs);
10858
+ args.data = args.data.concat(childs);
10825
10859
  }
10826
10860
  }
10827
10861
  if (args.requestType === 'add' || (this.isAddedRowByMethod && (this.parent.enableVirtualization || this.parent.enableInfiniteScrolling))) {
@@ -10866,6 +10900,7 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
10866
10900
  }
10867
10901
  if (this.isAddedRowByMethod && args.index !== 0) {
10868
10902
  this.addRowRecord = this.parent.flatData[args.index];
10903
+ this.addRowIndex = args.index;
10869
10904
  }
10870
10905
  if (this.parent.editSettings.newRowPosition === 'Child' && isNullOrUndefined(this.addRowRecord)
10871
10906
  && !isNullOrUndefined(this.parent.getSelectedRecords()[0])) {
@@ -10894,6 +10929,11 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
10894
10929
  var position = null;
10895
10930
  value.taskData = isNullOrUndefined(value.taskData) ? extend({}, args.data) : value.taskData;
10896
10931
  var currentData = this.parent.grid.getCurrentViewRecords();
10932
+ if (this.parent.enableVirtualization && args.index !== 0) {
10933
+ this.addRowIndex = this.parent.grid.getCurrentViewRecords().indexOf(this.addRowRecord);
10934
+ this.selectedIndex = parseInt(this.parent.getRows()[this.addRowIndex].getAttribute('aria-rowindex'));
10935
+
10936
+ }
10897
10937
  var index = this.addRowIndex;
10898
10938
  value.uniqueID = getUid(this.parent.element.id + '_data_');
10899
10939
  setValue('uniqueIDCollection.' + value.uniqueID, value, this.parent);
@@ -11415,7 +11455,9 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
11415
11455
  if (isNullOrUndefined(this.observer[containerRect])) {
11416
11456
  this.observer[containerRect] = this.observers[containerRect];
11417
11457
  }
11418
- _super.prototype[selectVirtualRow].call(this, args);
11458
+ if (args.selectedIndex !== 0 || isNullOrUndefined(this.parent['clipboardModule'].treeGridParent.editModule['addRowIndex'])) {
11459
+ _super.prototype[selectVirtualRow].call(this, args);
11460
+ }
11419
11461
  };
11420
11462
  VirtualTreeContentRenderer.prototype.refreshCell = function (rowObj) {
11421
11463
  rowObj.cells = this.generateCells();
@@ -11901,6 +11943,11 @@ var VirtualScroll$1 = /** @__PURE__ @class */ (function () {
11901
11943
  }
11902
11944
  //if ((this.prevendIndex !== -1 && this.prevstartIndex !== -1) &&
11903
11945
  //this.prevendIndex === endIndex && this.prevstartIndex === startIndex) {
11946
+ if (!isNullOrUndefined(this.expandCollapseRec) && (pageingDetails.actionArgs.requestType === 'virtualscroll' ||
11947
+ (pageingDetails.actionArgs.requestType === 'refresh' && startIndex !== this.prevstartIndex)) &&
11948
+ (startIndex < this.parent.getRows().length && endIndex <= startIndex + this.parent.getRows().length)) {
11949
+ startIndex = 0;
11950
+ }
11904
11951
  if (!isNullOrUndefined(this.expandCollapseRec)) {
11905
11952
  var resourceCount = this.parent.getRows();
11906
11953
  var sIndex = visualData.indexOf(this.expandCollapseRec);