@syncfusion/ej2-treegrid 19.4.52 → 19.4.56

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.
@@ -798,7 +798,8 @@ function findChildrenRecords(records) {
798
798
  }
799
799
  if (!isNullOrUndefined(records.childRecords)) {
800
800
  var childRecords = records.childRecords;
801
- for (var i = 0, len = Object.keys(childRecords).length; i < len; i++) {
801
+ var keys = Object.keys(childRecords);
802
+ for (var i = 0, len = keys.length; i < len; i++) {
802
803
  datas.push(childRecords[i]);
803
804
  if (childRecords[i].hasChildRecords || (!isNullOrUndefined(childRecords[i].childRecords) &&
804
805
  childRecords[i].childRecords.length)) {
@@ -1913,7 +1914,8 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
1913
1914
  this.hierarchyData = data;
1914
1915
  }
1915
1916
  else {
1916
- for (var i = 0; i < Object.keys(data).length; i++) {
1917
+ var keys = Object.keys(data);
1918
+ for (var i = 0; i < keys.length; i++) {
1917
1919
  var tempData = data[i];
1918
1920
  this.hierarchyData.push(extend({}, tempData));
1919
1921
  if (!isNullOrUndefined(tempData[this.parent.idMapping])) {
@@ -2153,7 +2155,8 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
2153
2155
  };
2154
2156
  DataManipulation.prototype.createRecords = function (data, parentRecords) {
2155
2157
  var treeGridData = [];
2156
- for (var i = 0, len = Object.keys(data).length; i < len; i++) {
2158
+ var keys = Object.keys(data);
2159
+ for (var i = 0, len = keys.length; i < len; i++) {
2157
2160
  var currentData = extend({}, data[i]);
2158
2161
  currentData.taskData = data[i];
2159
2162
  var level = 0;
@@ -3103,6 +3106,11 @@ function updateParentRow(key, record, action, control, isSelfReference, child) {
3103
3106
  column: control.grid.getColumns()[control.treeColumnIndex],
3104
3107
  requestType: action
3105
3108
  });
3109
+ if (control.enableImmutableMode && control['action'] === 'indenting' || control['action'] === 'outdenting') {
3110
+ control.renderModule.RowModifier({
3111
+ data: record, row: row
3112
+ });
3113
+ }
3106
3114
  }
3107
3115
  }
3108
3116
  }
@@ -3860,6 +3868,9 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
3860
3868
  };
3861
3869
  this.grid.rowDeselected = function (args) {
3862
3870
  _this.selectedRowIndex = _this.grid.selectedRowIndex;
3871
+ if (!isNullOrUndefined(args.data)) {
3872
+ _this.notify(rowDeselected, args);
3873
+ }
3863
3874
  _this.trigger(rowDeselected, args);
3864
3875
  };
3865
3876
  this.grid.resizeStop = function (args) {
@@ -4178,7 +4189,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4178
4189
  _this.grid.query = _this.grid.query instanceof Query ? _this.grid.query : new Query();
4179
4190
  }
4180
4191
  }
4181
- if (_this.action !== 'indent' && _this.action !== 'outdent') {
4192
+ if (_this.action !== 'indenting' && _this.action !== 'outdenting') {
4182
4193
  var callBackPromise_2 = new Deferred();
4183
4194
  _this.trigger(actionBegin, args, function (actionArgs) {
4184
4195
  if (!actionArgs.cancel) {
@@ -4207,7 +4218,8 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4207
4218
  if (args.requestType === 'save' && _this.aggregates.map(function (ag) { return ag.showChildSummary === true; }).length) {
4208
4219
  _this.grid.refresh();
4209
4220
  }
4210
- if (_this.action === 'indent' || _this.action === 'outdent') {
4221
+ if (_this.action === 'indenting' || _this.action === 'outdenting') {
4222
+ _this.action = _this.action === 'indenting' ? 'indented' : 'outdented';
4211
4223
  var actionArgs = {
4212
4224
  requestType: _this.action,
4213
4225
  data: _this.selectedRecords,
@@ -4419,7 +4431,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4419
4431
  case ToolbarItem.RowIndent:
4420
4432
  tooltipText = this.l10n.getConstant('RowIndent');
4421
4433
  items.push({
4422
- text: tooltipText, tooltipText: tooltipText,
4434
+ text: tooltipText, tooltipText: tooltipText, disabled: true,
4423
4435
  prefixIcon: 'e-indent', id: this.element.id + '_gridcontrol_indent'
4424
4436
  });
4425
4437
  break;
@@ -4427,7 +4439,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4427
4439
  case ToolbarItem.RowOutdent:
4428
4440
  tooltipText = this.l10n.getConstant('RowOutdent');
4429
4441
  items.push({
4430
- text: tooltipText, tooltipText: tooltipText,
4442
+ text: tooltipText, tooltipText: tooltipText, disabled: true,
4431
4443
  prefixIcon: 'e-outdent', id: this.element.id + '_gridcontrol_outdent'
4432
4444
  });
4433
4445
  break;
@@ -4471,7 +4483,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4471
4483
  gridColumn[prop] = this.getGridColumns(column[i][prop], false, index);
4472
4484
  treeGridColumn[prop] = column[i][prop];
4473
4485
  }
4474
- else {
4486
+ else if (!(treeColumn) || prop !== 'sortComparer') {
4475
4487
  gridColumn[prop] = treeGridColumn[prop] = column[i][prop];
4476
4488
  }
4477
4489
  }
@@ -7082,6 +7094,7 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7082
7094
  */
7083
7095
  RowDD$$1.prototype.reorderRows = function (fromIndexes, toIndex, position) {
7084
7096
  var tObj = this.parent;
7097
+ var action = 'action';
7085
7098
  if (fromIndexes[0] !== toIndex && ['above', 'below', 'child'].indexOf(position) !== -1) {
7086
7099
  if (position === 'above') {
7087
7100
  this.dropPosition = 'topSegment';
@@ -7108,6 +7121,11 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7108
7121
  if (tObj.isLocalData) {
7109
7122
  tObj.flatData = this.orderToIndex(tObj.flatData);
7110
7123
  }
7124
+ if (this.parent[action] === 'outdenting') {
7125
+ if (!isNullOrUndefined(data[0].parentItem)) {
7126
+ data[0].level = data[0].parentItem.level + 1;
7127
+ }
7128
+ }
7111
7129
  this.parent.grid.refresh();
7112
7130
  if (this.parent.enableImmutableMode && this.dropPosition === 'middleSegment') {
7113
7131
  var index = this.parent.treeColumnIndex + 1;
@@ -7128,6 +7146,11 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7128
7146
  column: this.parent.grid.getColumns()[this.parent.treeColumnIndex],
7129
7147
  requestType: 'rowDragAndDrop'
7130
7148
  });
7149
+ if (this.parent[action] === 'indenting' || this.parent[action] === 'outdenting') {
7150
+ this.parent.renderModule.RowModifier({
7151
+ data: totalRecord[i], row: rows[i]
7152
+ });
7153
+ }
7131
7154
  }
7132
7155
  }
7133
7156
  }
@@ -7276,7 +7299,8 @@ var RowDD$1 = /** @__PURE__ @class */ (function () {
7276
7299
  }
7277
7300
  // eslint-disable-next-line max-len
7278
7301
  if (tempDataSource && (!isNullOrUndefined(droppedRecord) && !droppedRecord.parentItem) && !isNullOrUndefined(droppedRecord.taskData)) {
7279
- for (var i = 0; i < Object.keys(tempDataSource).length; i++) {
7302
+ var keys = Object.keys(tempDataSource);
7303
+ for (var i = 0; i < keys.length; i++) {
7280
7304
  if (tempDataSource[i][this.parent.childMapping] === droppedRecord.taskData[this.parent.childMapping]) {
7281
7305
  idx = i;
7282
7306
  }
@@ -9140,6 +9164,7 @@ var Toolbar$1 = /** @__PURE__ @class */ (function () {
9140
9164
  */
9141
9165
  Toolbar$$1.prototype.addEventListener = function () {
9142
9166
  this.parent.on(rowSelected, this.refreshToolbar, this);
9167
+ this.parent.on(rowDeselected, this.refreshToolbar, this);
9143
9168
  this.parent.on(toolbarClick, this.toolbarClickHandler, this);
9144
9169
  };
9145
9170
  /**
@@ -9151,6 +9176,7 @@ var Toolbar$1 = /** @__PURE__ @class */ (function () {
9151
9176
  return;
9152
9177
  }
9153
9178
  this.parent.off(rowSelected, this.refreshToolbar);
9179
+ this.parent.off(rowDeselected, this.refreshToolbar);
9154
9180
  this.parent.off(toolbarClick, this.toolbarClickHandler);
9155
9181
  };
9156
9182
  Toolbar$$1.prototype.refreshToolbar = function (args) {
@@ -9158,7 +9184,7 @@ var Toolbar$1 = /** @__PURE__ @class */ (function () {
9158
9184
  if (args.row.rowIndex === 0 || tObj.getSelectedRecords().length > 1) {
9159
9185
  this.enableItems([tObj.element.id + '_gridcontrol_indent', tObj.element.id + '_gridcontrol_outdent'], false);
9160
9186
  }
9161
- else {
9187
+ else if (args['name'] !== "rowDeselected") {
9162
9188
  if (!isNullOrUndefined(tObj.getCurrentViewRecords()[args.row.rowIndex])) {
9163
9189
  if (!isNullOrUndefined(tObj.getCurrentViewRecords()[args.row.rowIndex]) &&
9164
9190
  (tObj.getCurrentViewRecords()[args.row.rowIndex].level >
@@ -9180,6 +9206,14 @@ var Toolbar$1 = /** @__PURE__ @class */ (function () {
9180
9206
  }
9181
9207
  }
9182
9208
  }
9209
+ if (args['name'] === "rowDeselected") {
9210
+ if (this.parent.toolbar['includes']('Indent')) {
9211
+ this.enableItems([tObj.element.id + '_gridcontrol_indent'], false);
9212
+ }
9213
+ if (this.parent.toolbar['includes']('Outdent')) {
9214
+ this.enableItems([tObj.element.id + '_gridcontrol_outdent'], false);
9215
+ }
9216
+ }
9183
9217
  if (args.row.rowIndex === 0 && !isNullOrUndefined(args.data.parentItem)) {
9184
9218
  this.enableItems([tObj.element.id + '_gridcontrol_outdent'], true);
9185
9219
  }
@@ -9211,8 +9245,8 @@ var Toolbar$1 = /** @__PURE__ @class */ (function () {
9211
9245
  else {
9212
9246
  dropIndex = tObj.getSelectedRowIndexes()[0] - 1;
9213
9247
  }
9214
- this.parent[action] = 'indent';
9215
- this.eventTrigger('indent', dropIndex);
9248
+ this.parent[action] = 'indenting';
9249
+ this.eventTrigger('indenting', dropIndex);
9216
9250
  }
9217
9251
  if (args.item.id === tObj.grid.element.id + '_outdent' && tObj.getSelectedRecords().length) {
9218
9252
  var dropIndex = void 0;
@@ -9222,8 +9256,8 @@ var Toolbar$1 = /** @__PURE__ @class */ (function () {
9222
9256
  dropIndex = i;
9223
9257
  }
9224
9258
  }
9225
- this.parent[action] = 'outdent';
9226
- this.eventTrigger('outdent', dropIndex);
9259
+ this.parent[action] = 'outdenting';
9260
+ this.eventTrigger('outdenting', dropIndex);
9227
9261
  }
9228
9262
  };
9229
9263
  Toolbar$$1.prototype.eventTrigger = function (action, dropIndex) {
@@ -9240,10 +9274,10 @@ var Toolbar$1 = /** @__PURE__ @class */ (function () {
9240
9274
  };
9241
9275
  this.parent.trigger(actionBegin, actionArgs, function (actionArgs) {
9242
9276
  if (!actionArgs.cancel) {
9243
- if (actionArgs.requestType === 'indent') {
9277
+ if (actionArgs.requestType === 'indenting') {
9244
9278
  _this.parent.reorderRows([_this.parent.getSelectedRowIndexes()[0]], dropIndex, 'child');
9245
9279
  }
9246
- else if (actionArgs.requestType === 'outdent') {
9280
+ else if (actionArgs.requestType === 'outdenting') {
9247
9281
  _this.parent.reorderRows([_this.parent.getSelectedRowIndexes()[0]], dropIndex, 'below');
9248
9282
  }
9249
9283
  }
@@ -10618,7 +10652,7 @@ var Edit$1 = /** @__PURE__ @class */ (function () {
10618
10652
  var promise = 'promise';
10619
10653
  var prom = args[promise];
10620
10654
  delete args[promise];
10621
- if (this.parent.enableVirtualization && !isNullOrUndefined(this.prevAriaRowIndex)) {
10655
+ if (this.parent.enableVirtualization && !isNullOrUndefined(this.prevAriaRowIndex) && this.prevAriaRowIndex !== '-1') {
10622
10656
  args.row.setAttribute('aria-rowindex', this.prevAriaRowIndex);
10623
10657
  this.prevAriaRowIndex = undefined;
10624
10658
  }