@syncfusion/ej2-treegrid 19.4.50 → 19.4.52

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.
@@ -4178,14 +4178,16 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4178
4178
  _this.grid.query = _this.grid.query instanceof Query ? _this.grid.query : new Query();
4179
4179
  }
4180
4180
  }
4181
- var callBackPromise = new Deferred();
4182
- _this.trigger(actionBegin, args, function (actionArgs) {
4183
- if (!actionArgs.cancel) {
4184
- _this.notify(beginEdit, actionArgs);
4185
- }
4186
- callBackPromise.resolve(actionArgs);
4187
- });
4188
- return callBackPromise;
4181
+ if (_this.action !== 'indent' && _this.action !== 'outdent') {
4182
+ var callBackPromise_2 = new Deferred();
4183
+ _this.trigger(actionBegin, args, function (actionArgs) {
4184
+ if (!actionArgs.cancel) {
4185
+ _this.notify(beginEdit, actionArgs);
4186
+ }
4187
+ callBackPromise_2.resolve(actionArgs);
4188
+ });
4189
+ return callBackPromise_2;
4190
+ }
4189
4191
  };
4190
4192
  this.grid.actionComplete = function (args) {
4191
4193
  _this.notify('actioncomplete', args);
@@ -4205,7 +4207,19 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4205
4207
  if (args.requestType === 'save' && _this.aggregates.map(function (ag) { return ag.showChildSummary === true; }).length) {
4206
4208
  _this.grid.refresh();
4207
4209
  }
4208
- _this.trigger(actionComplete, args);
4210
+ if (_this.action === 'indent' || _this.action === 'outdent') {
4211
+ var actionArgs = {
4212
+ requestType: _this.action,
4213
+ data: _this.selectedRecords,
4214
+ row: _this.selectedRows
4215
+ };
4216
+ _this.trigger(actionComplete, actionArgs);
4217
+ _this.action = '';
4218
+ _this.selectedRecords = _this.selectedRows = [];
4219
+ }
4220
+ else {
4221
+ _this.trigger(actionComplete, args);
4222
+ }
4209
4223
  };
4210
4224
  };
4211
4225
  TreeGrid.prototype.extendedGridEvents = function () {
@@ -5015,6 +5029,10 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5015
5029
  rowData.parentUniqueID = record.parentUniqueID;
5016
5030
  rowData.expanded = record.expanded;
5017
5031
  this.grid.setRowData(key, rowData);
5032
+ var table = this.getContentTable();
5033
+ var sHeight = table.scrollHeight;
5034
+ var clientHeight = this.getContent().clientHeight;
5035
+ this.lastRowBorder(this.getRows()[record.index], sHeight <= clientHeight);
5018
5036
  };
5019
5037
  /**
5020
5038
  * Navigates to the specified target page.
@@ -5781,7 +5799,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5781
5799
  }
5782
5800
  this.isExpandAll = true;
5783
5801
  this.isCollapseAll = true;
5784
- if (((this.allowPaging && this.pageSettings.pageSizeMode === 'All') || this.enableVirtualization) && !isRemoteData(this)) {
5802
+ if (((this.allowPaging && this.pageSettings.pageSizeMode === 'All') || this.enableVirtualization || this.enableInfiniteScrolling) && !isRemoteData(this)) {
5785
5803
  this.flatData.filter(function (e) {
5786
5804
  if (e.hasChildRecords) {
5787
5805
  e.expanded = action === 'collapse' ? false : true;
@@ -5840,7 +5858,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5840
5858
  if (!isNullOrUndefined(row)) {
5841
5859
  row.setAttribute('aria-expanded', action === 'expand' ? 'true' : 'false');
5842
5860
  }
5843
- if (((this.allowPaging && this.pageSettings.pageSizeMode === 'All') || this.enableVirtualization) && !isRemoteData(this)
5861
+ if (((this.allowPaging && this.pageSettings.pageSizeMode === 'All') || this.enableVirtualization || this.enableInfiniteScrolling) && !isRemoteData(this)
5844
5862
  && !isCountRequired(this)) {
5845
5863
  this.notify(localPagedExpandCollapse, { action: action, row: row, record: record });
5846
5864
  }
@@ -5903,7 +5921,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5903
5921
  var totalRows = this.getRows();
5904
5922
  var rows = this.getContentTable().rows;
5905
5923
  totalRows = [].slice.call(rows);
5906
- for (var i = totalRows.length - 1; i > 0; i--) {
5924
+ for (var i = totalRows.length - 1; i >= 0; i--) {
5907
5925
  if (!isHidden(totalRows[i])) {
5908
5926
  var table = this.getContentTable();
5909
5927
  var sHeight = table.scrollHeight;
@@ -9168,6 +9186,7 @@ var Toolbar$1 = /** @__PURE__ @class */ (function () {
9168
9186
  };
9169
9187
  Toolbar$$1.prototype.toolbarClickHandler = function (args) {
9170
9188
  var tObj = this.parent;
9189
+ var action = 'action';
9171
9190
  if (this.parent.editSettings.mode === 'Cell' && this.parent.grid.editSettings.mode === 'Batch' &&
9172
9191
  args.item.id === this.parent.grid.element.id + '_update') {
9173
9192
  args.cancel = true;
@@ -9192,10 +9211,10 @@ var Toolbar$1 = /** @__PURE__ @class */ (function () {
9192
9211
  else {
9193
9212
  dropIndex = tObj.getSelectedRowIndexes()[0] - 1;
9194
9213
  }
9195
- tObj.reorderRows([tObj.getSelectedRowIndexes()[0]], dropIndex, 'child');
9214
+ this.parent[action] = 'indent';
9215
+ this.eventTrigger('indent', dropIndex);
9196
9216
  }
9197
9217
  if (args.item.id === tObj.grid.element.id + '_outdent' && tObj.getSelectedRecords().length) {
9198
- var index = tObj.getSelectedRowIndexes()[0];
9199
9218
  var dropIndex = void 0;
9200
9219
  var parentItem = tObj.getSelectedRecords()[0].parentItem;
9201
9220
  for (var i = 0; i < tObj.getCurrentViewRecords().length; i++) {
@@ -9203,9 +9222,33 @@ var Toolbar$1 = /** @__PURE__ @class */ (function () {
9203
9222
  dropIndex = i;
9204
9223
  }
9205
9224
  }
9206
- tObj.reorderRows([index], dropIndex, 'below');
9225
+ this.parent[action] = 'outdent';
9226
+ this.eventTrigger('outdent', dropIndex);
9207
9227
  }
9208
9228
  };
9229
+ Toolbar$$1.prototype.eventTrigger = function (action, dropIndex) {
9230
+ var _this = this;
9231
+ var selectedRecords = 'selectedRecords';
9232
+ var selectedRows = 'selectedRows';
9233
+ this.parent[selectedRows] = this.parent.getSelectedRows();
9234
+ this.parent[selectedRecords] = this.parent.getSelectedRecords();
9235
+ var actionArgs = {
9236
+ requestType: action,
9237
+ data: this.parent.getSelectedRecords(),
9238
+ row: this.parent.getSelectedRows(),
9239
+ cancel: false
9240
+ };
9241
+ this.parent.trigger(actionBegin, actionArgs, function (actionArgs) {
9242
+ if (!actionArgs.cancel) {
9243
+ if (actionArgs.requestType === 'indent') {
9244
+ _this.parent.reorderRows([_this.parent.getSelectedRowIndexes()[0]], dropIndex, 'child');
9245
+ }
9246
+ else if (actionArgs.requestType === 'outdent') {
9247
+ _this.parent.reorderRows([_this.parent.getSelectedRowIndexes()[0]], dropIndex, 'below');
9248
+ }
9249
+ }
9250
+ });
9251
+ };
9209
9252
  /**
9210
9253
  * Gets the toolbar of the TreeGrid.
9211
9254
  *
@@ -12394,6 +12437,7 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
12394
12437
  this.parent.grid.on('infinite-edit-handler', this.infiniteEditHandler, this);
12395
12438
  this.parent.grid.on('infinite-crud-cancel', this.createRows, this);
12396
12439
  this.parent.grid.on('content-ready', this.contentready, this);
12440
+ this.parent.on(localPagedExpandCollapse, this.collapseExpandInfinitechilds, this);
12397
12441
  };
12398
12442
  /**
12399
12443
  * @hidden
@@ -12409,6 +12453,7 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
12409
12453
  this.parent.off(pagingActions, this.infinitePageAction);
12410
12454
  this.parent.grid.off('infinite-crud-cancel', this.createRows);
12411
12455
  this.parent.grid.off('content-ready', this.contentready);
12456
+ this.parent.off(localPagedExpandCollapse, this.collapseExpandInfinitechilds);
12412
12457
  };
12413
12458
  /**
12414
12459
  * Handles the Expand Collapse action for Remote data with infinite scrolling.
@@ -12458,6 +12503,18 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
12458
12503
  }
12459
12504
  }
12460
12505
  };
12506
+ InfiniteScroll$$1.prototype.collapseExpandInfinitechilds = function (row) {
12507
+ row.record.expanded = row.action === 'collapse' ? false : true;
12508
+ var ret = {
12509
+ result: this.parent.flatData,
12510
+ row: row.row,
12511
+ action: row.action,
12512
+ record: row.record,
12513
+ count: this.parent.flatData.length
12514
+ };
12515
+ var requestType = getValue('isCollapseAll', this.parent) ? 'collapseAll' : 'refresh';
12516
+ getValue('grid.renderModule', this.parent).dataManagerSuccess(ret, { requestType: requestType });
12517
+ };
12461
12518
  /**
12462
12519
  * Handles the page query for Data operations and CRUD actions.
12463
12520
  *
@@ -12468,9 +12525,13 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
12468
12525
  * @returns {void}
12469
12526
  */
12470
12527
  InfiniteScroll$$1.prototype.infinitePageAction = function (pageingDetails) {
12528
+ var _this = this;
12471
12529
  var dm = new DataManager(pageingDetails.result);
12472
12530
  var expanded$$1 = new Predicate('expanded', 'notequal', null).or('expanded', 'notequal', undefined);
12473
- var visualData = dm.executeLocal(new Query().where(expanded$$1));
12531
+ var infiniteParents = dm.executeLocal(new Query().where(expanded$$1));
12532
+ var visualData = infiniteParents.filter(function (e) {
12533
+ return getExpandStatus(_this.parent, e, infiniteParents);
12534
+ });
12474
12535
  var actionArgs = getValue('actionArgs', pageingDetails.actionArgs);
12475
12536
  var actions = getValue('actions', this.parent.grid.infiniteScrollModule);
12476
12537
  var initial = actions.some(function (value) { return value === actionArgs.requestType; });
@@ -12504,6 +12565,10 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
12504
12565
  query = query.take(this.parent.infiniteScrollSettings.initialBlocks * this.parent.pageSettings.pageSize);
12505
12566
  }
12506
12567
  else {
12568
+ if ((pageingDetails.actionArgs['action'] === 'expand' || pageingDetails.actionArgs['action'] === 'collapse') && this.parent.grid.pageSettings.currentPage !== 1) {
12569
+ current = 1;
12570
+ size = this.parent.pageSettings.pageSize * this.parent.grid.pageSettings.currentPage;
12571
+ }
12507
12572
  query = query.page(current, size);
12508
12573
  }
12509
12574
  }