@syncfusion/ej2-treegrid 31.2.10 → 31.2.15

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 31.2.10
3
+ * version : 31.2.15
4
4
  * Copyright Syncfusion Inc. 2001 - 2025. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncfusion/ej2-treegrid",
3
- "version": "31.2.10",
3
+ "version": "31.2.15",
4
4
  "description": "Essential JS 2 TreeGrid Component",
5
5
  "author": "Syncfusion Inc.",
6
6
  "license": "SEE LICENSE IN license",
@@ -8,10 +8,10 @@
8
8
  "module": "./index.js",
9
9
  "es2015": "./dist/es6/ej2-treegrid.es5.js",
10
10
  "dependencies": {
11
- "@syncfusion/ej2-base": "~31.2.5",
12
- "@syncfusion/ej2-data": "~31.2.5",
13
- "@syncfusion/ej2-grids": "~31.2.10",
14
- "@syncfusion/ej2-popups": "~31.2.5"
11
+ "@syncfusion/ej2-base": "~31.2.12",
12
+ "@syncfusion/ej2-data": "~31.2.12",
13
+ "@syncfusion/ej2-grids": "~31.2.15",
14
+ "@syncfusion/ej2-popups": "~31.2.12"
15
15
  },
16
16
  "devDependencies": {},
17
17
  "keywords": [
@@ -496,7 +496,7 @@ var BatchEdit = /** @class */ (function () {
496
496
  }
497
497
  else {
498
498
  var totalRecords = extendArray(data);
499
- if (totalRecords.length) {
499
+ if (totalRecords.length && currentViewRecords.length !== 0) {
500
500
  var startIndex = totalRecords.map(function (e) { return e["" + primarykey_1]; })
501
501
  .indexOf(currentViewRecords[0]["" + primarykey_1]);
502
502
  var endIndex = startIndex + this.parent.grid.pageSettings.pageSize;
@@ -26,6 +26,7 @@ export function editAction(details, control, isSelfReference, addRowIndex, selec
26
26
  var key = control.grid.getPrimaryKeyFieldNames()[0];
27
27
  var treeData = control.dataSource instanceof DataManager ?
28
28
  control.dataSource.dataSource.json : control.dataSource;
29
+ var gridData = control.grid.dataSource;
29
30
  var modifiedData = [];
30
31
  var originalData = value;
31
32
  var isSkip = false;
@@ -53,9 +54,9 @@ export function editAction(details, control, isSelfReference, addRowIndex, selec
53
54
  var keys = modifiedData[parseInt(k.toString(), 10)].taskData ?
54
55
  Object.keys(modifiedData[parseInt(k.toString(), 10)].taskData) :
55
56
  Object.keys(modifiedData[parseInt(k.toString(), 10)]);
56
- i = treeData.length;
57
+ i = treeData.length === 0 && gridData.length === 1 ? gridData.length : treeData.length;
57
58
  var _loop_1 = function () {
58
- if (treeData[parseInt(i.toString(), 10)]["" + key] === modifiedData[parseInt(k.toString(), 10)]["" + key]) {
59
+ if ((treeData.length === 0 && gridData.length === 1 && gridData[parseInt(i.toString(), 10)]["" + key] === modifiedData[parseInt(k.toString(), 10)]["" + key]) || treeData[parseInt(i.toString(), 10)]["" + key] === modifiedData[parseInt(k.toString(), 10)]["" + key]) {
59
60
  if (action === 'delete') {
60
61
  var currentData_1 = treeData[parseInt(i.toString(), 10)];
61
62
  treeData.splice(i, 1);
@@ -101,7 +102,10 @@ export function editAction(details, control, isSelfReference, addRowIndex, selec
101
102
  else if (action === 'add' || action === 'batchsave') {
102
103
  var index = void 0;
103
104
  if (control.editSettings.newRowPosition === 'Child') {
104
- if (isSelfReference) {
105
+ if (treeData.length === 0 && gridData.length === 1) {
106
+ treeData.push(originalData.taskData);
107
+ }
108
+ else if (isSelfReference) {
105
109
  originalData.taskData["" + control.parentIdMapping] = treeData[parseInt(i.toString(), 10)]["" + control.idMapping];
106
110
  treeData.splice(i + 1, 0, originalData.taskData);
107
111
  }
@@ -181,6 +185,9 @@ export function addAction(details, treeData, control, isSelfReference, addRowInd
181
185
  value = extend({}, addRowRecord);
182
186
  value = getPlainData(value);
183
187
  }
188
+ else if (currentViewRecords.length === 0) {
189
+ value = getPlainData(value);
190
+ }
184
191
  else {
185
192
  value = extend({}, currentViewRecords[addRowIndex + 1]);
186
193
  value = getPlainData(value);
@@ -194,8 +201,8 @@ export function addAction(details, treeData, control, isSelfReference, addRowInd
194
201
  }
195
202
  else {
196
203
  var primaryKeys = control.grid.getPrimaryKeyFieldNames()[0];
197
- var currentdata = currentViewRecords[parseInt(addRowIndex.toString(), 10)];
198
- if (!isNullOrUndefined(currentdata) && currentdata["" + primaryKeys] === details.value["" + primaryKeys] || selectedIndex !== -1) {
204
+ var currentdata = currentViewRecords.length > 0 ? currentViewRecords[parseInt(addRowIndex.toString(), 10)] : [];
205
+ if (!isNullOrUndefined(currentdata) && currentdata["" + primaryKeys] === details.value["" + primaryKeys] || selectedIndex !== -1 && treeData.length !== 0) {
199
206
  value = extend({}, currentdata);
200
207
  }
201
208
  else {
@@ -724,6 +724,9 @@ var Edit = /** @class */ (function () {
724
724
  // }
725
725
  // }
726
726
  Edit.prototype.beginEdit = function (args) {
727
+ if (this.parent.flatData.length === 0 && !isNullOrUndefined(this.addRowRecord)) {
728
+ this.addRowRecord = undefined;
729
+ }
727
730
  if (args.requestType === 'refresh' && this.isOnBatch) {
728
731
  args.cancel = true;
729
732
  return;
@@ -840,6 +840,7 @@ var TreeGrid = /** @class */ (function (_super) {
840
840
  if (this.isIndentEnabled) {
841
841
  this.refreshToolbarItems();
842
842
  }
843
+ this.updateColumnModel();
843
844
  this.wireEvents();
844
845
  this.renderComplete();
845
846
  var destroyTemplate = 'destroyTemplate';