@syncfusion/ej2-treegrid 19.4.48 → 19.4.54

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.
@@ -3103,6 +3103,11 @@ function updateParentRow(key, record, action, control, isSelfReference, child) {
3103
3103
  column: control.grid.getColumns()[control.treeColumnIndex],
3104
3104
  requestType: action
3105
3105
  });
3106
+ if (control.enableImmutableMode && control['action'] === 'indenting' || control['action'] === 'outdenting') {
3107
+ control.renderModule.RowModifier({
3108
+ data: record, row: row
3109
+ });
3110
+ }
3106
3111
  }
3107
3112
  }
3108
3113
  }
@@ -3860,6 +3865,9 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
3860
3865
  };
3861
3866
  this.grid.rowDeselected = function (args) {
3862
3867
  _this.selectedRowIndex = _this.grid.selectedRowIndex;
3868
+ if (!isNullOrUndefined(args.data)) {
3869
+ _this.notify(rowDeselected, args);
3870
+ }
3863
3871
  _this.trigger(rowDeselected, args);
3864
3872
  };
3865
3873
  this.grid.resizeStop = function (args) {
@@ -4178,14 +4186,16 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4178
4186
  _this.grid.query = _this.grid.query instanceof Query ? _this.grid.query : new Query();
4179
4187
  }
4180
4188
  }
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;
4189
+ if (_this.action !== 'indenting' && _this.action !== 'outdenting') {
4190
+ var callBackPromise_2 = new Deferred();
4191
+ _this.trigger(actionBegin, args, function (actionArgs) {
4192
+ if (!actionArgs.cancel) {
4193
+ _this.notify(beginEdit, actionArgs);
4194
+ }
4195
+ callBackPromise_2.resolve(actionArgs);
4196
+ });
4197
+ return callBackPromise_2;
4198
+ }
4189
4199
  };
4190
4200
  this.grid.actionComplete = function (args) {
4191
4201
  _this.notify('actioncomplete', args);
@@ -4205,7 +4215,20 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4205
4215
  if (args.requestType === 'save' && _this.aggregates.map(function (ag) { return ag.showChildSummary === true; }).length) {
4206
4216
  _this.grid.refresh();
4207
4217
  }
4208
- _this.trigger(actionComplete, args);
4218
+ if (_this.action === 'indenting' || _this.action === 'outdenting') {
4219
+ _this.action = _this.action === 'indenting' ? 'indented' : 'outdented';
4220
+ var actionArgs = {
4221
+ requestType: _this.action,
4222
+ data: _this.selectedRecords,
4223
+ row: _this.selectedRows
4224
+ };
4225
+ _this.trigger(actionComplete, actionArgs);
4226
+ _this.action = '';
4227
+ _this.selectedRecords = _this.selectedRows = [];
4228
+ }
4229
+ else {
4230
+ _this.trigger(actionComplete, args);
4231
+ }
4209
4232
  };
4210
4233
  };
4211
4234
  TreeGrid.prototype.extendedGridEvents = function () {
@@ -4405,7 +4428,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4405
4428
  case ToolbarItem.RowIndent:
4406
4429
  tooltipText = this.l10n.getConstant('RowIndent');
4407
4430
  items.push({
4408
- text: tooltipText, tooltipText: tooltipText,
4431
+ text: tooltipText, tooltipText: tooltipText, disabled: true,
4409
4432
  prefixIcon: 'e-indent', id: this.element.id + '_gridcontrol_indent'
4410
4433
  });
4411
4434
  break;
@@ -4413,7 +4436,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4413
4436
  case ToolbarItem.RowOutdent:
4414
4437
  tooltipText = this.l10n.getConstant('RowOutdent');
4415
4438
  items.push({
4416
- text: tooltipText, tooltipText: tooltipText,
4439
+ text: tooltipText, tooltipText: tooltipText, disabled: true,
4417
4440
  prefixIcon: 'e-outdent', id: this.element.id + '_gridcontrol_outdent'
4418
4441
  });
4419
4442
  break;
@@ -5015,6 +5038,10 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5015
5038
  rowData.parentUniqueID = record.parentUniqueID;
5016
5039
  rowData.expanded = record.expanded;
5017
5040
  this.grid.setRowData(key, rowData);
5041
+ var table = this.getContentTable();
5042
+ var sHeight = table.scrollHeight;
5043
+ var clientHeight = this.getContent().clientHeight;
5044
+ this.lastRowBorder(this.getRows()[record.index], sHeight <= clientHeight);
5018
5045
  };
5019
5046
  /**
5020
5047
  * Navigates to the specified target page.
@@ -5781,7 +5808,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5781
5808
  }
5782
5809
  this.isExpandAll = true;
5783
5810
  this.isCollapseAll = true;
5784
- if (((this.allowPaging && this.pageSettings.pageSizeMode === 'All') || this.enableVirtualization) && !isRemoteData(this)) {
5811
+ if (((this.allowPaging && this.pageSettings.pageSizeMode === 'All') || this.enableVirtualization || this.enableInfiniteScrolling) && !isRemoteData(this)) {
5785
5812
  this.flatData.filter(function (e) {
5786
5813
  if (e.hasChildRecords) {
5787
5814
  e.expanded = action === 'collapse' ? false : true;
@@ -5840,7 +5867,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5840
5867
  if (!isNullOrUndefined(row)) {
5841
5868
  row.setAttribute('aria-expanded', action === 'expand' ? 'true' : 'false');
5842
5869
  }
5843
- if (((this.allowPaging && this.pageSettings.pageSizeMode === 'All') || this.enableVirtualization) && !isRemoteData(this)
5870
+ if (((this.allowPaging && this.pageSettings.pageSizeMode === 'All') || this.enableVirtualization || this.enableInfiniteScrolling) && !isRemoteData(this)
5844
5871
  && !isCountRequired(this)) {
5845
5872
  this.notify(localPagedExpandCollapse, { action: action, row: row, record: record });
5846
5873
  }
@@ -5903,7 +5930,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5903
5930
  var totalRows = this.getRows();
5904
5931
  var rows = this.getContentTable().rows;
5905
5932
  totalRows = [].slice.call(rows);
5906
- for (var i = totalRows.length - 1; i > 0; i--) {
5933
+ for (var i = totalRows.length - 1; i >= 0; i--) {
5907
5934
  if (!isHidden(totalRows[i])) {
5908
5935
  var table = this.getContentTable();
5909
5936
  var sHeight = table.scrollHeight;
@@ -7064,6 +7091,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7064
7091
  */
7065
7092
  RowDD$$1.prototype.reorderRows = function (fromIndexes, toIndex, position) {
7066
7093
  var tObj = this.parent;
7094
+ var action = 'action';
7067
7095
  if (fromIndexes[0] !== toIndex && ['above', 'below', 'child'].indexOf(position) !== -1) {
7068
7096
  if (position === 'above') {
7069
7097
  this.dropPosition = 'topSegment';
@@ -7090,6 +7118,11 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7090
7118
  if (tObj.isLocalData) {
7091
7119
  tObj.flatData = this.orderToIndex(tObj.flatData);
7092
7120
  }
7121
+ if (this.parent[action] === 'outdenting') {
7122
+ if (!isNullOrUndefined(data[0].parentItem)) {
7123
+ data[0].level = data[0].parentItem.level + 1;
7124
+ }
7125
+ }
7093
7126
  this.parent.grid.refresh();
7094
7127
  if (this.parent.enableImmutableMode && this.dropPosition === 'middleSegment') {
7095
7128
  var index = this.parent.treeColumnIndex + 1;
@@ -7110,6 +7143,11 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7110
7143
  column: this.parent.grid.getColumns()[this.parent.treeColumnIndex],
7111
7144
  requestType: 'rowDragAndDrop'
7112
7145
  });
7146
+ if (this.parent[action] === 'indenting' || this.parent[action] === 'outdenting') {
7147
+ this.parent.renderModule.RowModifier({
7148
+ data: totalRecord[i], row: rows[i]
7149
+ });
7150
+ }
7113
7151
  }
7114
7152
  }
7115
7153
  }
@@ -9122,6 +9160,7 @@ var Toolbar$1 = /** @__PURE__ @class */ (function () {
9122
9160
  */
9123
9161
  Toolbar$$1.prototype.addEventListener = function () {
9124
9162
  this.parent.on(rowSelected, this.refreshToolbar, this);
9163
+ this.parent.on(rowDeselected, this.refreshToolbar, this);
9125
9164
  this.parent.on(toolbarClick, this.toolbarClickHandler, this);
9126
9165
  };
9127
9166
  /**
@@ -9133,6 +9172,7 @@ var Toolbar$1 = /** @__PURE__ @class */ (function () {
9133
9172
  return;
9134
9173
  }
9135
9174
  this.parent.off(rowSelected, this.refreshToolbar);
9175
+ this.parent.off(rowDeselected, this.refreshToolbar);
9136
9176
  this.parent.off(toolbarClick, this.toolbarClickHandler);
9137
9177
  };
9138
9178
  Toolbar$$1.prototype.refreshToolbar = function (args) {
@@ -9140,7 +9180,7 @@ var Toolbar$1 = /** @__PURE__ @class */ (function () {
9140
9180
  if (args.row.rowIndex === 0 || tObj.getSelectedRecords().length > 1) {
9141
9181
  this.enableItems([tObj.element.id + '_gridcontrol_indent', tObj.element.id + '_gridcontrol_outdent'], false);
9142
9182
  }
9143
- else {
9183
+ else if (args['name'] !== "rowDeselected") {
9144
9184
  if (!isNullOrUndefined(tObj.getCurrentViewRecords()[args.row.rowIndex])) {
9145
9185
  if (!isNullOrUndefined(tObj.getCurrentViewRecords()[args.row.rowIndex]) &&
9146
9186
  (tObj.getCurrentViewRecords()[args.row.rowIndex].level >
@@ -9162,12 +9202,21 @@ var Toolbar$1 = /** @__PURE__ @class */ (function () {
9162
9202
  }
9163
9203
  }
9164
9204
  }
9205
+ if (args['name'] === "rowDeselected") {
9206
+ if (this.parent.toolbar['includes']('Indent')) {
9207
+ this.enableItems([tObj.element.id + '_gridcontrol_indent'], false);
9208
+ }
9209
+ if (this.parent.toolbar['includes']('Outdent')) {
9210
+ this.enableItems([tObj.element.id + '_gridcontrol_outdent'], false);
9211
+ }
9212
+ }
9165
9213
  if (args.row.rowIndex === 0 && !isNullOrUndefined(args.data.parentItem)) {
9166
9214
  this.enableItems([tObj.element.id + '_gridcontrol_outdent'], true);
9167
9215
  }
9168
9216
  };
9169
9217
  Toolbar$$1.prototype.toolbarClickHandler = function (args) {
9170
9218
  var tObj = this.parent;
9219
+ var action = 'action';
9171
9220
  if (this.parent.editSettings.mode === 'Cell' && this.parent.grid.editSettings.mode === 'Batch' &&
9172
9221
  args.item.id === this.parent.grid.element.id + '_update') {
9173
9222
  args.cancel = true;
@@ -9192,10 +9241,10 @@ var Toolbar$1 = /** @__PURE__ @class */ (function () {
9192
9241
  else {
9193
9242
  dropIndex = tObj.getSelectedRowIndexes()[0] - 1;
9194
9243
  }
9195
- tObj.reorderRows([tObj.getSelectedRowIndexes()[0]], dropIndex, 'child');
9244
+ this.parent[action] = 'indenting';
9245
+ this.eventTrigger('indenting', dropIndex);
9196
9246
  }
9197
9247
  if (args.item.id === tObj.grid.element.id + '_outdent' && tObj.getSelectedRecords().length) {
9198
- var index = tObj.getSelectedRowIndexes()[0];
9199
9248
  var dropIndex = void 0;
9200
9249
  var parentItem = tObj.getSelectedRecords()[0].parentItem;
9201
9250
  for (var i = 0; i < tObj.getCurrentViewRecords().length; i++) {
@@ -9203,9 +9252,33 @@ var Toolbar$1 = /** @__PURE__ @class */ (function () {
9203
9252
  dropIndex = i;
9204
9253
  }
9205
9254
  }
9206
- tObj.reorderRows([index], dropIndex, 'below');
9255
+ this.parent[action] = 'outdenting';
9256
+ this.eventTrigger('outdenting', dropIndex);
9207
9257
  }
9208
9258
  };
9259
+ Toolbar$$1.prototype.eventTrigger = function (action, dropIndex) {
9260
+ var _this = this;
9261
+ var selectedRecords = 'selectedRecords';
9262
+ var selectedRows = 'selectedRows';
9263
+ this.parent[selectedRows] = this.parent.getSelectedRows();
9264
+ this.parent[selectedRecords] = this.parent.getSelectedRecords();
9265
+ var actionArgs = {
9266
+ requestType: action,
9267
+ data: this.parent.getSelectedRecords(),
9268
+ row: this.parent.getSelectedRows(),
9269
+ cancel: false
9270
+ };
9271
+ this.parent.trigger(actionBegin, actionArgs, function (actionArgs) {
9272
+ if (!actionArgs.cancel) {
9273
+ if (actionArgs.requestType === 'indenting') {
9274
+ _this.parent.reorderRows([_this.parent.getSelectedRowIndexes()[0]], dropIndex, 'child');
9275
+ }
9276
+ else if (actionArgs.requestType === 'outdenting') {
9277
+ _this.parent.reorderRows([_this.parent.getSelectedRowIndexes()[0]], dropIndex, 'below');
9278
+ }
9279
+ }
9280
+ });
9281
+ };
9209
9282
  /**
9210
9283
  * Gets the toolbar of the TreeGrid.
9211
9284
  *
@@ -12394,6 +12467,7 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
12394
12467
  this.parent.grid.on('infinite-edit-handler', this.infiniteEditHandler, this);
12395
12468
  this.parent.grid.on('infinite-crud-cancel', this.createRows, this);
12396
12469
  this.parent.grid.on('content-ready', this.contentready, this);
12470
+ this.parent.on(localPagedExpandCollapse, this.collapseExpandInfinitechilds, this);
12397
12471
  };
12398
12472
  /**
12399
12473
  * @hidden
@@ -12409,6 +12483,7 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
12409
12483
  this.parent.off(pagingActions, this.infinitePageAction);
12410
12484
  this.parent.grid.off('infinite-crud-cancel', this.createRows);
12411
12485
  this.parent.grid.off('content-ready', this.contentready);
12486
+ this.parent.off(localPagedExpandCollapse, this.collapseExpandInfinitechilds);
12412
12487
  };
12413
12488
  /**
12414
12489
  * Handles the Expand Collapse action for Remote data with infinite scrolling.
@@ -12458,6 +12533,18 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
12458
12533
  }
12459
12534
  }
12460
12535
  };
12536
+ InfiniteScroll$$1.prototype.collapseExpandInfinitechilds = function (row) {
12537
+ row.record.expanded = row.action === 'collapse' ? false : true;
12538
+ var ret = {
12539
+ result: this.parent.flatData,
12540
+ row: row.row,
12541
+ action: row.action,
12542
+ record: row.record,
12543
+ count: this.parent.flatData.length
12544
+ };
12545
+ var requestType = getValue('isCollapseAll', this.parent) ? 'collapseAll' : 'refresh';
12546
+ getValue('grid.renderModule', this.parent).dataManagerSuccess(ret, { requestType: requestType });
12547
+ };
12461
12548
  /**
12462
12549
  * Handles the page query for Data operations and CRUD actions.
12463
12550
  *
@@ -12468,9 +12555,13 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
12468
12555
  * @returns {void}
12469
12556
  */
12470
12557
  InfiniteScroll$$1.prototype.infinitePageAction = function (pageingDetails) {
12558
+ var _this = this;
12471
12559
  var dm = new DataManager(pageingDetails.result);
12472
12560
  var expanded$$1 = new Predicate('expanded', 'notequal', null).or('expanded', 'notequal', undefined);
12473
- var visualData = dm.executeLocal(new Query().where(expanded$$1));
12561
+ var infiniteParents = dm.executeLocal(new Query().where(expanded$$1));
12562
+ var visualData = infiniteParents.filter(function (e) {
12563
+ return getExpandStatus(_this.parent, e, infiniteParents);
12564
+ });
12474
12565
  var actionArgs = getValue('actionArgs', pageingDetails.actionArgs);
12475
12566
  var actions = getValue('actions', this.parent.grid.infiniteScrollModule);
12476
12567
  var initial = actions.some(function (value) { return value === actionArgs.requestType; });
@@ -12504,6 +12595,10 @@ var InfiniteScroll$1 = /** @__PURE__ @class */ (function () {
12504
12595
  query = query.take(this.parent.infiniteScrollSettings.initialBlocks * this.parent.pageSettings.pageSize);
12505
12596
  }
12506
12597
  else {
12598
+ if ((pageingDetails.actionArgs['action'] === 'expand' || pageingDetails.actionArgs['action'] === 'collapse') && this.parent.grid.pageSettings.currentPage !== 1) {
12599
+ current = 1;
12600
+ size = this.parent.pageSettings.pageSize * this.parent.grid.pageSettings.currentPage;
12601
+ }
12507
12602
  query = query.page(current, size);
12508
12603
  }
12509
12604
  }