@syncfusion/ej2-treegrid 19.4.42 → 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.
@@ -3297,7 +3297,9 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
3297
3297
  * @returns {void}
3298
3298
  */
3299
3299
  TreeGrid.prototype.sortByColumn = function (columnName, direction, isMultiSort) {
3300
- this.sortModule.sortColumn(columnName, direction, isMultiSort);
3300
+ if (this.sortModule) {
3301
+ this.sortModule.sortColumn(columnName, direction, isMultiSort);
3302
+ }
3301
3303
  };
3302
3304
  /**
3303
3305
  * Clears all the sorted columns of the TreeGrid.
@@ -3317,7 +3319,9 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
3317
3319
  * @hidden
3318
3320
  */
3319
3321
  TreeGrid.prototype.removeSortColumn = function (field) {
3320
- this.sortModule.removeSortColumn(field);
3322
+ if (this.sortModule) {
3323
+ this.sortModule.removeSortColumn(field);
3324
+ }
3321
3325
  };
3322
3326
  /**
3323
3327
  * Searches TreeGrid records using the given key.
@@ -3676,6 +3680,9 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
3676
3680
  this.grid.isReact = true;
3677
3681
  this.grid.portals = [];
3678
3682
  }
3683
+ if (this.isVue) {
3684
+ this.grid.isVue = true;
3685
+ }
3679
3686
  createSpinner({ target: this.element }, this.createElement);
3680
3687
  this.log(['mapping_fields_missing']);
3681
3688
  this.renderModule = new Render(this);
@@ -4171,14 +4178,16 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4171
4178
  _this.grid.query = _this.grid.query instanceof Query ? _this.grid.query : new Query();
4172
4179
  }
4173
4180
  }
4174
- var callBackPromise = new Deferred();
4175
- _this.trigger(actionBegin, args, function (actionArgs) {
4176
- if (!actionArgs.cancel) {
4177
- _this.notify(beginEdit, actionArgs);
4178
- }
4179
- callBackPromise.resolve(actionArgs);
4180
- });
4181
- 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
+ }
4182
4191
  };
4183
4192
  this.grid.actionComplete = function (args) {
4184
4193
  _this.notify('actioncomplete', args);
@@ -4198,7 +4207,19 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4198
4207
  if (args.requestType === 'save' && _this.aggregates.map(function (ag) { return ag.showChildSummary === true; }).length) {
4199
4208
  _this.grid.refresh();
4200
4209
  }
4201
- _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
+ }
4202
4223
  };
4203
4224
  };
4204
4225
  TreeGrid.prototype.extendedGridEvents = function () {
@@ -5008,6 +5029,10 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5008
5029
  rowData.parentUniqueID = record.parentUniqueID;
5009
5030
  rowData.expanded = record.expanded;
5010
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);
5011
5036
  };
5012
5037
  /**
5013
5038
  * Navigates to the specified target page.
@@ -5565,7 +5590,12 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5565
5590
  });
5566
5591
  }
5567
5592
  else if (isNullOrUndefined(record)) {
5568
- record = this.grid.getCurrentViewRecords()[row.rowIndex];
5593
+ if (this.detailTemplate) {
5594
+ record = this.grid.getCurrentViewRecords()[row.getAttribute('aria-rowindex')];
5595
+ }
5596
+ else {
5597
+ record = this.grid.getCurrentViewRecords()[row.rowIndex];
5598
+ }
5569
5599
  }
5570
5600
  return record;
5571
5601
  };
@@ -5769,7 +5799,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5769
5799
  }
5770
5800
  this.isExpandAll = true;
5771
5801
  this.isCollapseAll = true;
5772
- 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)) {
5773
5803
  this.flatData.filter(function (e) {
5774
5804
  if (e.hasChildRecords) {
5775
5805
  e.expanded = action === 'collapse' ? false : true;
@@ -5828,7 +5858,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5828
5858
  if (!isNullOrUndefined(row)) {
5829
5859
  row.setAttribute('aria-expanded', action === 'expand' ? 'true' : 'false');
5830
5860
  }
5831
- 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)
5832
5862
  && !isCountRequired(this)) {
5833
5863
  this.notify(localPagedExpandCollapse, { action: action, row: row, record: record });
5834
5864
  }
@@ -5891,7 +5921,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5891
5921
  var totalRows = this.getRows();
5892
5922
  var rows = this.getContentTable().rows;
5893
5923
  totalRows = [].slice.call(rows);
5894
- for (var i = totalRows.length - 1; i > 0; i--) {
5924
+ for (var i = totalRows.length - 1; i >= 0; i--) {
5895
5925
  if (!isHidden(totalRows[i])) {
5896
5926
  var table = this.getContentTable();
5897
5927
  var sHeight = table.scrollHeight;
@@ -9156,6 +9186,7 @@ var Toolbar$1 = /** @__PURE__ @class */ (function () {
9156
9186
  };
9157
9187
  Toolbar$$1.prototype.toolbarClickHandler = function (args) {
9158
9188
  var tObj = this.parent;
9189
+ var action = 'action';
9159
9190
  if (this.parent.editSettings.mode === 'Cell' && this.parent.grid.editSettings.mode === 'Batch' &&
9160
9191
  args.item.id === this.parent.grid.element.id + '_update') {
9161
9192
  args.cancel = true;
@@ -9180,10 +9211,10 @@ var Toolbar$1 = /** @__PURE__ @class */ (function () {
9180
9211
  else {
9181
9212
  dropIndex = tObj.getSelectedRowIndexes()[0] - 1;
9182
9213
  }
9183
- tObj.reorderRows([tObj.getSelectedRowIndexes()[0]], dropIndex, 'child');
9214
+ this.parent[action] = 'indent';
9215
+ this.eventTrigger('indent', dropIndex);
9184
9216
  }
9185
9217
  if (args.item.id === tObj.grid.element.id + '_outdent' && tObj.getSelectedRecords().length) {
9186
- var index = tObj.getSelectedRowIndexes()[0];
9187
9218
  var dropIndex = void 0;
9188
9219
  var parentItem = tObj.getSelectedRecords()[0].parentItem;
9189
9220
  for (var i = 0; i < tObj.getCurrentViewRecords().length; i++) {
@@ -9191,9 +9222,33 @@ var Toolbar$1 = /** @__PURE__ @class */ (function () {
9191
9222
  dropIndex = i;
9192
9223
  }
9193
9224
  }
9194
- tObj.reorderRows([index], dropIndex, 'below');
9225
+ this.parent[action] = 'outdent';
9226
+ this.eventTrigger('outdent', dropIndex);
9195
9227
  }
9196
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
+ };
9197
9252
  /**
9198
9253
  * Gets the toolbar of the TreeGrid.
9199
9254
  *
@@ -12139,7 +12194,7 @@ var VirtualScroll$1 = /** @__PURE__ @class */ (function () {
12139
12194
  if (pageingDetails.count < this.parent.getRows()[0].getBoundingClientRect().height) {
12140
12195
  startIndex = 0;
12141
12196
  }
12142
- else {
12197
+ else if (!this.parent['isExpandAll']) {
12143
12198
  startIndex = this.prevstartIndex === -1 ? 0 : this.prevstartIndex;
12144
12199
  }
12145
12200
  }
@@ -12382,6 +12437,7 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
12382
12437
  this.parent.grid.on('infinite-edit-handler', this.infiniteEditHandler, this);
12383
12438
  this.parent.grid.on('infinite-crud-cancel', this.createRows, this);
12384
12439
  this.parent.grid.on('content-ready', this.contentready, this);
12440
+ this.parent.on(localPagedExpandCollapse, this.collapseExpandInfinitechilds, this);
12385
12441
  };
12386
12442
  /**
12387
12443
  * @hidden
@@ -12397,6 +12453,7 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
12397
12453
  this.parent.off(pagingActions, this.infinitePageAction);
12398
12454
  this.parent.grid.off('infinite-crud-cancel', this.createRows);
12399
12455
  this.parent.grid.off('content-ready', this.contentready);
12456
+ this.parent.off(localPagedExpandCollapse, this.collapseExpandInfinitechilds);
12400
12457
  };
12401
12458
  /**
12402
12459
  * Handles the Expand Collapse action for Remote data with infinite scrolling.
@@ -12446,6 +12503,18 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
12446
12503
  }
12447
12504
  }
12448
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
+ };
12449
12518
  /**
12450
12519
  * Handles the page query for Data operations and CRUD actions.
12451
12520
  *
@@ -12456,9 +12525,13 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
12456
12525
  * @returns {void}
12457
12526
  */
12458
12527
  InfiniteScroll$$1.prototype.infinitePageAction = function (pageingDetails) {
12528
+ var _this = this;
12459
12529
  var dm = new DataManager(pageingDetails.result);
12460
12530
  var expanded$$1 = new Predicate('expanded', 'notequal', null).or('expanded', 'notequal', undefined);
12461
- 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
+ });
12462
12535
  var actionArgs = getValue('actionArgs', pageingDetails.actionArgs);
12463
12536
  var actions = getValue('actions', this.parent.grid.infiniteScrollModule);
12464
12537
  var initial = actions.some(function (value) { return value === actionArgs.requestType; });
@@ -12492,6 +12565,10 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
12492
12565
  query = query.take(this.parent.infiniteScrollSettings.initialBlocks * this.parent.pageSettings.pageSize);
12493
12566
  }
12494
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
+ }
12495
12572
  query = query.page(current, size);
12496
12573
  }
12497
12574
  }