@syncfusion/ej2-treegrid 27.2.2 → 28.1.33

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.
Files changed (96) hide show
  1. package/README.md +2 -2
  2. package/dist/ej2-treegrid.min.js +3 -3
  3. package/dist/ej2-treegrid.umd.min.js +3 -3
  4. package/dist/ej2-treegrid.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-treegrid.es2015.js +576 -256
  6. package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
  7. package/dist/es6/ej2-treegrid.es5.js +580 -256
  8. package/dist/es6/ej2-treegrid.es5.js.map +1 -1
  9. package/dist/global/ej2-treegrid.min.js +3 -3
  10. package/dist/global/ej2-treegrid.min.js.map +1 -1
  11. package/dist/global/index.d.ts +2 -2
  12. package/package.json +10 -10
  13. package/src/treegrid/actions/batch-edit.js +58 -56
  14. package/src/treegrid/actions/context-menu.js +3 -1
  15. package/src/treegrid/actions/reorder.d.ts +1 -1
  16. package/src/treegrid/actions/reorder.js +5 -17
  17. package/src/treegrid/actions/rowdragdrop.d.ts +286 -14
  18. package/src/treegrid/actions/rowdragdrop.js +447 -161
  19. package/src/treegrid/actions/virtual-scroll.js +5 -0
  20. package/src/treegrid/base/data.js +22 -5
  21. package/src/treegrid/base/treegrid.d.ts +1 -0
  22. package/src/treegrid/base/treegrid.js +27 -10
  23. package/src/treegrid/renderer/virtual-tree-content-render.js +14 -7
  24. package/styles/bds-lite.css +703 -0
  25. package/styles/bds-lite.scss +18 -0
  26. package/styles/bds.css +723 -0
  27. package/styles/bds.scss +19 -0
  28. package/styles/bootstrap-dark-lite.css +20 -0
  29. package/styles/bootstrap-dark.css +26 -6
  30. package/styles/bootstrap-lite.css +20 -0
  31. package/styles/bootstrap.css +26 -6
  32. package/styles/bootstrap4-lite.css +20 -0
  33. package/styles/bootstrap4.css +26 -6
  34. package/styles/bootstrap5-dark-lite.css +20 -0
  35. package/styles/bootstrap5-dark.css +26 -6
  36. package/styles/bootstrap5-lite.css +20 -0
  37. package/styles/bootstrap5.3-lite.css +20 -0
  38. package/styles/bootstrap5.3.css +26 -6
  39. package/styles/bootstrap5.css +26 -6
  40. package/styles/fabric-dark-lite.css +20 -0
  41. package/styles/fabric-dark.css +26 -6
  42. package/styles/fabric-lite.css +20 -0
  43. package/styles/fabric.css +26 -6
  44. package/styles/fluent-dark-lite.css +20 -0
  45. package/styles/fluent-dark.css +27 -7
  46. package/styles/fluent-lite.css +20 -0
  47. package/styles/fluent.css +27 -7
  48. package/styles/fluent2-lite.css +20 -0
  49. package/styles/fluent2.css +28 -8
  50. package/styles/highcontrast-light-lite.css +20 -0
  51. package/styles/highcontrast-light.css +26 -6
  52. package/styles/highcontrast-lite.css +21 -1
  53. package/styles/highcontrast.css +28 -8
  54. package/styles/material-dark-lite.css +20 -0
  55. package/styles/material-dark.css +26 -6
  56. package/styles/material-lite.css +20 -0
  57. package/styles/material.css +26 -6
  58. package/styles/material3-dark-lite.css +20 -0
  59. package/styles/material3-dark.css +26 -6
  60. package/styles/material3-lite.css +20 -0
  61. package/styles/material3.css +26 -6
  62. package/styles/tailwind-dark-lite.css +20 -0
  63. package/styles/tailwind-dark.css +26 -6
  64. package/styles/tailwind-lite.css +20 -0
  65. package/styles/tailwind.css +26 -6
  66. package/styles/tailwind3-lite.css +511 -0
  67. package/styles/tailwind3-lite.scss +18 -0
  68. package/styles/tailwind3.css +531 -0
  69. package/styles/tailwind3.scss +19 -0
  70. package/styles/treegrid/_bigger.scss +45 -41
  71. package/styles/treegrid/_layout.scss +23 -2
  72. package/styles/treegrid/_tailwind3-definition.scss +24 -0
  73. package/styles/treegrid/bds.css +723 -0
  74. package/styles/treegrid/bds.scss +19 -0
  75. package/styles/treegrid/bootstrap-dark.css +26 -6
  76. package/styles/treegrid/bootstrap.css +26 -6
  77. package/styles/treegrid/bootstrap4.css +26 -6
  78. package/styles/treegrid/bootstrap5-dark.css +26 -6
  79. package/styles/treegrid/bootstrap5.3.css +26 -6
  80. package/styles/treegrid/bootstrap5.css +26 -6
  81. package/styles/treegrid/fabric-dark.css +26 -6
  82. package/styles/treegrid/fabric.css +26 -6
  83. package/styles/treegrid/fluent-dark.css +27 -7
  84. package/styles/treegrid/fluent.css +27 -7
  85. package/styles/treegrid/fluent2.css +28 -8
  86. package/styles/treegrid/highcontrast-light.css +26 -6
  87. package/styles/treegrid/highcontrast.css +28 -8
  88. package/styles/treegrid/icons/_tailwind3.scss +37 -0
  89. package/styles/treegrid/material-dark.css +26 -6
  90. package/styles/treegrid/material.css +26 -6
  91. package/styles/treegrid/material3-dark.css +26 -6
  92. package/styles/treegrid/material3.css +26 -6
  93. package/styles/treegrid/tailwind-dark.css +26 -6
  94. package/styles/treegrid/tailwind.css +26 -6
  95. package/styles/treegrid/tailwind3.css +531 -0
  96. package/styles/treegrid/tailwind3.scss +19 -0
@@ -1,4 +1,4 @@
1
- import { Property, merge, ChildProperty, Collection, isNullOrUndefined, Browser, removeClass, addClass, getValue, createElement, setValue, extend as extend$1, Internationalization, getEnumValue, compile, L10n, EventHandler, KeyboardEvents, SanitizeHtmlHelper, Complex, Event, NotifyPropertyChanges, Component, closest, classList, setStyleAttribute, select, debounce, remove } from '@syncfusion/ej2-base';
1
+ import { Property, merge, ChildProperty, Collection, isNullOrUndefined, Browser, removeClass, addClass, getValue, createElement, setValue, extend as extend$1, Internationalization, getEnumValue, compile, L10n, EventHandler, KeyboardEvents, SanitizeHtmlHelper, Complex, Event, NotifyPropertyChanges, Component, closest, setStyleAttribute, select, classList, debounce, remove } from '@syncfusion/ej2-base';
2
2
  import { Grid, Logger as Logger$1, detailLists, Clipboard, getObject, parentsUntil, Print as Print$1, templateCompiler, appendChildren, extend, CellRenderer, getUid, CellType, Freeze as Freeze$1, getNumberFormat, getActualProperties, iterateArrayOrObject, RowDropSettings as RowDropSettings$1, Reorder as Reorder$1, Resize as Resize$1, Scroll, RowDD as RowDD$1, VirtualRowModelGenerator, Filter as Filter$1, Data, ExportHelper, ExcelExport as ExcelExport$1, PdfExport as PdfExport$1, Page as Page$1, Toolbar as Toolbar$1, calculateAggregate, Aggregate as Aggregate$1, Sort as Sort$1, ColumnMenu as ColumnMenu$1, ContextMenu as ContextMenu$1, resetRowIndex, Edit as Edit$1, CommandColumn as CommandColumn$1, DetailRow as DetailRow$1, Cell, VirtualContentRenderer, InterSectionObserver, getTransformValues, RenderType, VirtualHeaderRenderer, VirtualScroll as VirtualScroll$1, ColumnChooser as ColumnChooser$1, RowRenderer, InfiniteScroll as InfiniteScroll$1 } from '@syncfusion/ej2-grids';
3
3
  import { createCheckBox } from '@syncfusion/ej2-buttons';
4
4
  import { DataManager, ODataAdaptor, WebApiAdaptor, WebMethodAdaptor, CacheAdaptor, UrlAdaptor, Query, DataUtil, RemoteSaveAdaptor, Deferred, JsonAdaptor, Predicate as Predicate$1 } from '@syncfusion/ej2-data';
@@ -2239,6 +2239,7 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
2239
2239
  * @returns {void}
2240
2240
  */
2241
2241
  DataManipulation.prototype.updateParentRemoteData = function (args) {
2242
+ var _this = this;
2242
2243
  var actionArgs = 'actionArgs';
2243
2244
  if (isRemoteData(this.parent) && this.parent.enableVirtualization && args["" + actionArgs].requestType === 'virtualscroll') {
2244
2245
  this.parent.hideSpinner();
@@ -2278,9 +2279,15 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
2278
2279
  records[parseInt(rec.toString(), 10)].taskData = extend$1({}, records[parseInt(rec.toString(), 10)]);
2279
2280
  records[parseInt(rec.toString(), 10)].uniqueID = getUid(this_1.parent.element.id + '_data_');
2280
2281
  setValue('uniqueIDCollection.' + records[parseInt(rec.toString(), 10)].uniqueID, records[parseInt(rec.toString(), 10)], this_1.parent);
2281
- records[parseInt(rec.toString(), 10)].level = 0;
2282
- if (isRemoteData(this_1.parent) && this_1.parent.enableVirtualization && records[parseInt(rec.toString(), 10)]["" + this_1.parent.parentIdMapping] && records[parseInt(rec.toString(), 10)].level === 0) {
2283
- records[parseInt(rec.toString(), 10)].level = records[parseInt(rec.toString(), 10)].level + 1;
2282
+ if (isRemoteData(this_1.parent) && this_1.parent.enableVirtualization && records[parseInt(rec.toString(), 10)]["" + this_1.parent.parentIdMapping] && (isNullOrUndefined(records[parseInt(rec.toString(), 10)].level) || records[parseInt(rec.toString(), 10)].level === 0)) {
2283
+ var parentID_1 = records[parseInt(rec.toString(), 10)]["" + this_1.parent.parentIdMapping];
2284
+ var parentRec = records.find(function (record) { return record["" + _this.parent.idMapping] === parentID_1; });
2285
+ if (parentRec) {
2286
+ records[parseInt(rec.toString(), 10)].level = parentRec.level + 1;
2287
+ }
2288
+ }
2289
+ else {
2290
+ records[parseInt(rec.toString(), 10)].level = 0;
2284
2291
  }
2285
2292
  records[parseInt(rec.toString(), 10)].index = Math.ceil(Math.random() * 1000);
2286
2293
  if ((records[parseInt(rec.toString(), 10)][this_1.parent.hasChildMapping] ||
@@ -2486,7 +2493,7 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
2486
2493
  var parentData = _this.parent["" + remoteExpandedData][parseInt(i.toString(), 10)];
2487
2494
  delete parentData.childRecords;
2488
2495
  result[parseInt(r.toString(), 10)].parentItem = parentData;
2489
- result[parseInt(r.toString(), 10)].parentUniqueID = rowDetails.record.uniqueID;
2496
+ result[parseInt(r.toString(), 10)].parentUniqueID = parentData.uniqueID;
2490
2497
  }
2491
2498
  }
2492
2499
  }
@@ -2521,6 +2528,9 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
2521
2528
  }
2522
2529
  result[parseInt(r.toString(), 10)].index = Math.ceil(Math.random() * 1000);
2523
2530
  result[parseInt(r.toString(), 10)].uniqueID = getUid(_this.parent.element.id + '_data_');
2531
+ if (rowDetails.record["" + _this.parent.idMapping] === result[parseInt(r.toString(), 10)]["" + _this.parent.idMapping]) {
2532
+ rowDetails.record.uniqueID = result[parseInt(r.toString(), 10)].uniqueID;
2533
+ }
2524
2534
  result[parseInt(r.toString(), 10)].checkboxState = 'uncheck';
2525
2535
  if (_this.parent.enableVirtualization && isNullOrUndefined(result[parseInt(r.toString(), 10)].level)) {
2526
2536
  for (var p = 0; p < _this.parent.grid.currentViewData.length; p++) {
@@ -2709,7 +2719,14 @@ var DataManipulation = /** @__PURE__ @class */ (function () {
2709
2719
  this.parent.flatData.push(currentData);
2710
2720
  }
2711
2721
  else if (isNullOrUndefined(currentData["" + this.parent.parentIdMapping]) || currentData.parentItem) {
2712
- this.parent.flatData.push(currentData);
2722
+ if (!isNullOrUndefined(this.parent.rowDropSettings.targetID)) {
2723
+ if (!this.parent.rowDragAndDropModule['isDuplicateData'](currentData)) {
2724
+ this.parent.flatData.push(currentData);
2725
+ }
2726
+ }
2727
+ else {
2728
+ this.parent.flatData.push(currentData);
2729
+ }
2713
2730
  this.parent['infiniteScrollData'].push(currentData);
2714
2731
  }
2715
2732
  if (!this.isSelfReference && currentData.level === 0) {
@@ -4218,7 +4235,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4218
4235
  TreeGrid.prototype.requiredModules = function () {
4219
4236
  var modules = [];
4220
4237
  var splitFrozenCount = 'splitFrozenCount';
4221
- if (!this.isReact && isNullOrUndefined(this['changedProperties'].columns)) {
4238
+ if (isNullOrUndefined(this['changedProperties'].columns)) {
4222
4239
  this.grid["" + splitFrozenCount](this.getColumns());
4223
4240
  }
4224
4241
  if (this.isDestroyed) {
@@ -4723,7 +4740,9 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
4723
4740
  if (_this.pageSettings.pageSizeMode === 'Root') {
4724
4741
  _this.grid.selectionModule['totalRecordsCount'] = _this.grid.currentViewData.length;
4725
4742
  }
4726
- _this.trigger(rowSelecting, args);
4743
+ if (!args.cancel) {
4744
+ _this.trigger(rowSelecting, args);
4745
+ }
4727
4746
  };
4728
4747
  this.grid.rowDeselecting = function (args) {
4729
4748
  _this.IsExpandCollapseClicked(args);
@@ -5494,11 +5513,8 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
5494
5513
  TreeGrid.prototype.onPropertyChanged = function (newProp) {
5495
5514
  var properties = Object.keys(newProp);
5496
5515
  var requireRefresh = false;
5497
- if (properties.indexOf('columns') > -1 && !isNullOrUndefined(newProp.columns) && this.frozenColumns === 0
5498
- && this.frozenRows === 0 && !this.columnModel.some(function (col) { return col.isFrozen || col.freeze; })) {
5499
- this.grid.columns = this.getGridColumns(newProp.columns);
5500
- this.grid['updateColumnObject']();
5501
- requireRefresh = true;
5516
+ if (properties.indexOf('columns') > -1 && !isNullOrUndefined(newProp.columns)) {
5517
+ this.refreshColumns();
5502
5518
  }
5503
5519
  for (var _i = 0, properties_1 = properties; _i < properties_1.length; _i++) {
5504
5520
  var prop = properties_1[_i];
@@ -6551,12 +6567,28 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
6551
6567
  TreeGrid.prototype.refreshColumns = function (refreshUI) {
6552
6568
  if (isNullOrUndefined(refreshUI) || refreshUI) {
6553
6569
  this.grid.columns = this.getGridColumns(this.columns);
6570
+ this.getTreeColumn();
6554
6571
  this.grid.refreshColumns();
6555
6572
  }
6556
6573
  else {
6557
6574
  this.grid.setProperties({ columns: this.getGridColumns(this.columns) }, true);
6558
6575
  }
6559
6576
  };
6577
+ TreeGrid.prototype.getTreeColumn = function () {
6578
+ var columnModel = 'columnModel';
6579
+ var treeColumn = this["" + columnModel][this.treeColumnIndex];
6580
+ var treeIndex;
6581
+ var updatedCols = this.getColumns();
6582
+ for (var f = 0; f < updatedCols.length; f++) {
6583
+ var treeColumnfield = getObject('field', treeColumn);
6584
+ var parentColumnfield = getObject('field', updatedCols[parseInt(f.toString(), 10)]);
6585
+ if (treeColumnfield === parentColumnfield) {
6586
+ treeIndex = f;
6587
+ break;
6588
+ }
6589
+ }
6590
+ this.setProperties({ treeColumnIndex: treeIndex }, true);
6591
+ };
6560
6592
  /**
6561
6593
  * Refreshes the TreeGrid header.
6562
6594
  *
@@ -7368,7 +7400,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
7368
7400
  this.toggleRowVisibility(freezeRightRows[parseInt(i.toString(), 10)], displayAction);
7369
7401
  }
7370
7402
  this.notify('childRowExpand', { row: rows[parseInt(i.toString(), 10)] });
7371
- if ((!isNullOrUndefined(childRecords[parseInt(i.toString(), 10)].childRecords) && childRecords[parseInt(i.toString(), 10)].childRecords.length > 0) && (action !== 'expand' ||
7403
+ if ((!isNullOrUndefined(childRecords)) && (!isNullOrUndefined(childRecords[parseInt(i.toString(), 10)].childRecords) && childRecords[parseInt(i.toString(), 10)].childRecords.length > 0) && (action !== 'expand' ||
7372
7404
  isNullOrUndefined(childRecords[parseInt(i.toString(), 10)].expanded) || childRecords[parseInt(i.toString(), 10)].expanded)) {
7373
7405
  this.expandCollapse(action, rows[parseInt(i.toString(), 10)], childRecords[parseInt(i.toString(), 10)], true);
7374
7406
  if (this.frozenColumns <= this.treeColumnIndex && !isNullOrUndefined(movableRows)) {
@@ -7390,7 +7422,7 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
7390
7422
  };
7391
7423
  TreeGrid.prototype.toggleRowVisibility = function (row, displayAction) {
7392
7424
  if (row) {
7393
- row.classList.remove('e-childrow-hidden', 'e-childrow-visible');
7425
+ row.classList.remove('e-childrow-hidden', 'e-childrow-visible', 'e-hide');
7394
7426
  row.classList.add(displayAction);
7395
7427
  }
7396
7428
  };
@@ -7895,7 +7927,9 @@ var TreeGrid = /** @__PURE__ @class */ (function (_super) {
7895
7927
  * @returns {void}
7896
7928
  */
7897
7929
  TreeGrid.prototype.reorderRows = function (fromIndexes, toIndex, position) {
7898
- this.rowDragAndDropModule.reorderRows(fromIndexes, toIndex, position);
7930
+ if (!isNullOrUndefined(this.rowDragAndDropModule)) {
7931
+ this.rowDragAndDropModule.reorderRows(fromIndexes, toIndex, position);
7932
+ }
7899
7933
  };
7900
7934
  /**
7901
7935
  * Indents the record to one level of hierarchy. Moves the selected row as the last child of its previous row.
@@ -8351,13 +8385,13 @@ var Reorder = /** @__PURE__ @class */ (function () {
8351
8385
  * @returns {void}
8352
8386
  */
8353
8387
  Reorder.prototype.addEventListener = function () {
8354
- this.parent.on('getColumnIndex', this.getTreeColumn, this);
8388
+ this.parent.on('getColumnIndex', this.updateTreeColumn, this);
8355
8389
  };
8356
8390
  Reorder.prototype.removeEventListener = function () {
8357
8391
  if (this.parent.isDestroyed) {
8358
8392
  return;
8359
8393
  }
8360
- this.parent.off('getColumnIndex', this.getTreeColumn);
8394
+ this.parent.off('getColumnIndex', this.updateTreeColumn);
8361
8395
  };
8362
8396
  /**
8363
8397
  * To destroy the Reorder
@@ -8368,20 +8402,8 @@ var Reorder = /** @__PURE__ @class */ (function () {
8368
8402
  Reorder.prototype.destroy = function () {
8369
8403
  this.removeEventListener();
8370
8404
  };
8371
- Reorder.prototype.getTreeColumn = function () {
8372
- var columnModel = 'columnModel';
8373
- var treeColumn = this.parent["" + columnModel][this.parent.treeColumnIndex];
8374
- var treeIndex;
8375
- var updatedCols = this.parent.getColumns();
8376
- for (var f = 0; f < updatedCols.length; f++) {
8377
- var treeColumnfield = getObject('field', treeColumn);
8378
- var parentColumnfield = getObject('field', updatedCols[parseInt(f.toString(), 10)]);
8379
- if (treeColumnfield === parentColumnfield) {
8380
- treeIndex = f;
8381
- break;
8382
- }
8383
- }
8384
- this.parent.setProperties({ treeColumnIndex: treeIndex }, true);
8405
+ Reorder.prototype.updateTreeColumn = function () {
8406
+ this.parent['getTreeColumn']();
8385
8407
  };
8386
8408
  return Reorder;
8387
8409
  }());
@@ -8446,24 +8468,44 @@ var RowDD = /** @__PURE__ @class */ (function () {
8446
8468
  * @param {TreeGrid} parent - Tree Grid instance
8447
8469
  */
8448
8470
  function RowDD(parent) {
8449
- /** @hidden */
8471
+ /** @hidden
8472
+ * Indicates whether a row can be dropped into the current target position during a drag-and-drop operation.
8473
+ */
8450
8474
  this.canDrop = true;
8451
- /** @hidden */
8475
+ /** @hidden
8476
+ * Indicates whether the current drag operation includes child records of the dragged item.
8477
+ */
8452
8478
  this.isDraggedWithChild = false;
8453
- /** @hidden */
8479
+ /** @hidden
8480
+ * Indicates whether multiple TreeGrid instances are being managed or displayed.
8481
+ */
8454
8482
  this.modifiedRecords = 'modifiedRecords';
8455
- /** @hidden */
8483
+ /** @hidden
8484
+ * Represents the currently selected item in the TreeGrid.
8485
+ */
8456
8486
  this.selectedRecords = 'selectedRecords';
8457
- /** @hidden */
8487
+ /** @hidden
8488
+ * Holds an array of currently selected records in the TreeGrid.
8489
+ */
8458
8490
  this.selectedRows = 'selectedRows';
8459
- /** @hidden */
8491
+ /** @hidden
8492
+ * Indicates whether there is a droppable item in the TreeGrid.
8493
+ */
8460
8494
  this.hasDropItem = true;
8461
- /** @hidden */
8495
+ /** @hidden
8496
+ * Indicates whether the item is being added to the bottom of the TreeGrid.
8497
+ */
8462
8498
  this.isaddtoBottom = false;
8463
8499
  Grid.Inject(RowDD$1);
8464
8500
  this.parent = parent;
8465
8501
  this.addEventListener();
8466
8502
  }
8503
+ /**
8504
+ * Retrieves child records for a specified parent ID in the TreeGrid.
8505
+ *
8506
+ * @param {string} id - The unique ID of the parent record for which to retrieve child records.
8507
+ * @returns {ITreeData[]} An array of child records corresponding to the specified parent ID.
8508
+ */
8467
8509
  RowDD.prototype.getChildrecordsByParentID = function (id) {
8468
8510
  var treeGridDataSource;
8469
8511
  if (this.parent.dataSource instanceof DataManager && isOffline(this.parent)) {
@@ -8497,6 +8539,9 @@ var RowDD = /** @__PURE__ @class */ (function () {
8497
8539
  */
8498
8540
  RowDD.prototype.reorderRows = function (fromIndexes, toIndex, position) {
8499
8541
  var tObj = this.parent;
8542
+ if (fromIndexes[0] === toIndex || ['above', 'below', 'child'].indexOf(position) === -1) {
8543
+ return;
8544
+ }
8500
8545
  var action = 'action';
8501
8546
  var dropPosition = 'dropPosition';
8502
8547
  var updateRowAndCellElements = 'updateRowAndCellElements';
@@ -8535,13 +8580,9 @@ var RowDD = /** @__PURE__ @class */ (function () {
8535
8580
  }
8536
8581
  this.parent.grid.refresh();
8537
8582
  if (this.parent.enableImmutableMode && this.dropPosition === 'middleSegment') {
8538
- var index = void 0;
8539
- if (this.parent.allowRowDragAndDrop) {
8540
- index = this.parent.treeColumnIndex + 1;
8541
- }
8542
- else if (this.parent["" + action] === 'indenting') {
8543
- index = this.parent.treeColumnIndex;
8544
- }
8583
+ var index = this.parent.allowRowDragAndDrop
8584
+ ? this.parent.treeColumnIndex + 1
8585
+ : (this.parent["" + action] === 'indenting' ? this.parent.treeColumnIndex : undefined);
8545
8586
  var row = this.parent.getRows()[fromIndexes[0]];
8546
8587
  var dropData = args.data[0];
8547
8588
  var totalRecord = [];
@@ -8556,13 +8597,9 @@ var RowDD = /** @__PURE__ @class */ (function () {
8556
8597
  this.parent["" + updateRowAndCellElements](totalRecord, rows, index);
8557
8598
  }
8558
8599
  if (this.parent.enableImmutableMode && this.parent["" + action] === 'outdenting') {
8559
- var index = void 0;
8560
- if (this.parent.allowRowDragAndDrop) {
8561
- index = this.parent.treeColumnIndex + 1;
8562
- }
8563
- else if (this.parent["" + action] === 'outdenting') {
8564
- index = this.parent.treeColumnIndex;
8565
- }
8600
+ var index = this.parent.allowRowDragAndDrop
8601
+ ? this.parent.treeColumnIndex + 1
8602
+ : (this.parent["" + action] === 'outdenting' ? this.parent.treeColumnIndex : undefined);
8566
8603
  var record = args.data[0];
8567
8604
  var row = this.parent.getRows()[fromIndexes[0]];
8568
8605
  var totalRecord = [];
@@ -8572,10 +8609,14 @@ var RowDD = /** @__PURE__ @class */ (function () {
8572
8609
  this.parent["" + updateRowAndCellElements](totalRecord, rows, index);
8573
8610
  }
8574
8611
  }
8575
- else {
8576
- return;
8577
- }
8578
8612
  };
8613
+ /**
8614
+ * Performs indent or outdent actions on selected records in the TreeGrid.
8615
+ *
8616
+ * @param {ITreeData} [record] - The record to be indented or outdented. If undefined, the method operates on the currently selected record.
8617
+ * @param {string} [request] - The action to perform, either 'indent' or 'outdent'.
8618
+ * @returns {void}
8619
+ */
8579
8620
  RowDD.prototype.indentOutdentAction = function (record, request) {
8580
8621
  var tObj = this.parent;
8581
8622
  var action = 'action';
@@ -8650,6 +8691,13 @@ var RowDD = /** @__PURE__ @class */ (function () {
8650
8691
  }
8651
8692
  }
8652
8693
  };
8694
+ /**
8695
+ * Triggers a specified event for the TreeGrid, notifying subscribers about the event occurrence.
8696
+ *
8697
+ * @param {string} action - The action to be triggered, either 'indenting' or 'outdenting'.
8698
+ * @param {number} dropIndex - The index at which the row should be dropped.
8699
+ * @returns {void}
8700
+ */
8653
8701
  RowDD.prototype.eventTrigger = function (action, dropIndex) {
8654
8702
  var _this = this;
8655
8703
  var actionArgs = {
@@ -8679,6 +8727,12 @@ var RowDD = /** @__PURE__ @class */ (function () {
8679
8727
  }
8680
8728
  });
8681
8729
  };
8730
+ /**
8731
+ * Reorders the flat data array of the TreeGrid and updates the index of each record.
8732
+ *
8733
+ * @param {ITreeData[]} currentData - The array of tree data records to reorder.
8734
+ * @returns {ITreeData[]} The updated array of tree data records with indices set.
8735
+ */
8682
8736
  RowDD.prototype.orderToIndex = function (currentData) {
8683
8737
  for (var i = 0; i < currentData.length; i++) {
8684
8738
  currentData[parseInt(i.toString(), 10)].index = i;
@@ -8689,6 +8743,15 @@ var RowDD = /** @__PURE__ @class */ (function () {
8689
8743
  }
8690
8744
  return currentData;
8691
8745
  };
8746
+ /**
8747
+ * Handles the addition of new rows to the TreeGrid.
8748
+ *
8749
+ * @param {Object} e - The event object containing information about the rows being added.
8750
+ * @param {number} e.toIndex - The index at which the new rows should be added in the TreeGrid.
8751
+ * @param {Object[]} e.records - An array of the records to be added to the TreeGrid.
8752
+ *
8753
+ * @returns {void} This function does not return any value.
8754
+ */
8692
8755
  RowDD.prototype.rowsAdded = function (e) {
8693
8756
  var draggedRecord;
8694
8757
  var dragRecords = e.records;
@@ -8793,6 +8856,15 @@ var RowDD = /** @__PURE__ @class */ (function () {
8793
8856
  this.dropRows(args);
8794
8857
  }
8795
8858
  };
8859
+ /**
8860
+ * Handles the removal of specified rows from the TreeGrid.
8861
+ *
8862
+ * @param {Object} e - The event object containing information about the removed rows.
8863
+ * @param {number[]} e.indexes - An array of indexes of the rows that were removed.
8864
+ * @param {Object[]} e.records - An array of the records corresponding to the removed rows.
8865
+ *
8866
+ * @returns {void} This function does not return any value.
8867
+ */
8796
8868
  RowDD.prototype.rowsRemoved = function (e) {
8797
8869
  for (var i = 0; i < e.records.length; i++) {
8798
8870
  this.draggedRecord = e.records[parseInt(i.toString(), 10)];
@@ -8804,35 +8876,36 @@ var RowDD = /** @__PURE__ @class */ (function () {
8804
8876
  }
8805
8877
  }
8806
8878
  };
8879
+ /**
8880
+ * Refreshes the data source of the TreeGrid.
8881
+ *
8882
+ * @returns {void} This function does not return any value.
8883
+ */
8807
8884
  RowDD.prototype.refreshGridDataSource = function () {
8808
8885
  var draggedRecord = this.draggedRecord;
8809
8886
  var droppedRecord = this.droppedRecord;
8810
8887
  var proxy = this.parent;
8811
- var tempDataSource;
8812
- var idx;
8888
+ var temporaryDataSource;
8889
+ var indexOfDroppedRecord;
8813
8890
  if (this.parent.dataSource instanceof DataManager && isOffline(this.parent)) {
8814
- tempDataSource = proxy.dataSource.dataSource.json;
8891
+ temporaryDataSource = proxy.dataSource.dataSource.json;
8815
8892
  }
8816
8893
  else {
8817
- tempDataSource = proxy.dataSource;
8894
+ temporaryDataSource = proxy.dataSource;
8818
8895
  }
8819
- if (tempDataSource && (!isNullOrUndefined(droppedRecord) && !droppedRecord.parentItem)
8896
+ if (temporaryDataSource && (!isNullOrUndefined(droppedRecord) && !droppedRecord.parentItem)
8820
8897
  && !isNullOrUndefined(droppedRecord.taskData)) {
8821
- var keys = Object.keys(tempDataSource);
8898
+ var keys = Object.keys(temporaryDataSource);
8822
8899
  for (var i = 0; i < keys.length; i++) {
8823
- if (tempDataSource[parseInt(i.toString(), 10)][this.parent.childMapping] ===
8900
+ if (temporaryDataSource[parseInt(i.toString(), 10)][this.parent.childMapping] ===
8824
8901
  droppedRecord.taskData[this.parent.childMapping]) {
8825
- idx = i;
8826
- }
8827
- }
8828
- if (this.dropPosition === 'topSegment') {
8829
- if (!this.parent.idMapping) {
8830
- tempDataSource.splice(idx, 0, draggedRecord.taskData);
8902
+ indexOfDroppedRecord = i;
8831
8903
  }
8832
8904
  }
8833
- else if (this.dropPosition === 'bottomSegment') {
8834
- if (!this.parent.idMapping) {
8835
- tempDataSource.splice(idx + 1, 0, draggedRecord.taskData);
8905
+ if (!this.parent.idMapping) {
8906
+ var positionAdjustment = this.dropPosition === 'topSegment' ? 0 : 1;
8907
+ if (this.dropPosition === 'topSegment' || this.dropPosition === 'bottomSegment') {
8908
+ temporaryDataSource.splice(indexOfDroppedRecord + positionAdjustment, 0, draggedRecord.taskData);
8836
8909
  }
8837
8910
  }
8838
8911
  }
@@ -8863,6 +8936,12 @@ var RowDD = /** @__PURE__ @class */ (function () {
8863
8936
  }
8864
8937
  }
8865
8938
  };
8939
+ /**
8940
+ * Removes the border from the first row of the TreeGrid.
8941
+ *
8942
+ * @param {HTMLTableRowElement} element - The table row element from which to remove the border.
8943
+ * @returns {void} This function does not return any value.
8944
+ */
8866
8945
  RowDD.prototype.removeFirstrowBorder = function (element) {
8867
8946
  var canremove = this.dropPosition === 'bottomSegment';
8868
8947
  if (this.parent.element.getElementsByClassName('e-firstrow-border').length > 0 && element &&
@@ -8870,25 +8949,40 @@ var RowDD = /** @__PURE__ @class */ (function () {
8870
8949
  this.parent.element.getElementsByClassName('e-firstrow-border')[0].remove();
8871
8950
  }
8872
8951
  };
8952
+ /**
8953
+ * Removes the border from the last row of the TreeGrid.
8954
+ *
8955
+ * @param {HTMLTableRowElement} element - The row element from which to remove the last row border.
8956
+ * @returns {void}
8957
+ */
8873
8958
  RowDD.prototype.removeLastrowBorder = function (element) {
8874
- var isEmptyRow = element && (element.classList.contains('e-emptyrow') || element.classList.contains('e-columnheader')
8875
- || element.classList.contains('e-detailrow'));
8876
- var islastRowIndex;
8877
- if (this.parent.enableVirtualization) {
8878
- islastRowIndex = element && !isEmptyRow &&
8879
- this.parent.getRows()[this.parent.getCurrentViewRecords().length - 1].getAttribute('data-uid') !==
8880
- element.getAttribute('data-uid');
8959
+ if (!element) {
8960
+ return;
8881
8961
  }
8882
- else {
8883
- islastRowIndex = element && !isEmptyRow &&
8884
- this.parent.getRowByIndex(this.parent.getCurrentViewRecords().length - 1).getAttribute('data-uid') !==
8885
- element.getAttribute('data-uid');
8962
+ var isEmptyRow = element.classList.contains('e-emptyrow') ||
8963
+ element.classList.contains('e-columnheader') ||
8964
+ element.classList.contains('e-detailrow');
8965
+ if (isEmptyRow) {
8966
+ return;
8886
8967
  }
8887
- var canremove = islastRowIndex || this.dropPosition === 'topSegment';
8888
- if (this.parent.element.getElementsByClassName('e-lastrow-border').length > 0 && element && (islastRowIndex || canremove)) {
8889
- this.parent.element.getElementsByClassName('e-lastrow-border')[0].remove();
8968
+ var lastRow = this.parent.enableVirtualization ?
8969
+ this.parent.getRows()[this.parent.getCurrentViewRecords().length - 1] :
8970
+ this.parent.getRowByIndex(this.parent.getCurrentViewRecords().length - 1);
8971
+ var isNotLastRow = lastRow.getAttribute('data-uid') !== element.getAttribute('data-uid');
8972
+ var canRemove = isNotLastRow || this.dropPosition === 'topSegment';
8973
+ var lastRowBorderElement = this.parent.element.getElementsByClassName('e-lastrow-border')[0];
8974
+ if (lastRowBorderElement && canRemove) {
8975
+ lastRowBorderElement.remove();
8890
8976
  }
8891
8977
  };
8978
+ /**
8979
+ * Updates the icons associated with the specified rows in the TreeGrid.
8980
+ *
8981
+ * @param {Element[]} row - The array of row elements to update the icons for.
8982
+ * @param {number} index - The index of the row being updated.
8983
+ * @param {RowDragEventArgs} args - The event arguments associated with the row drag operation.
8984
+ * @returns {string} The drop position ('topSegment', 'middleSegment', 'bottomSegment', or 'Invalid').
8985
+ */
8892
8986
  RowDD.prototype.updateIcon = function (row, index, args) {
8893
8987
  var rowEle = args.target ? closest(args.target, 'tr') : null;
8894
8988
  this.dropPosition = undefined;
@@ -8900,6 +8994,10 @@ var RowDD = /** @__PURE__ @class */ (function () {
8900
8994
  || !parentsUntil(args.target, 'e-gridcontent')) {
8901
8995
  this.dropPosition = 'Invalid';
8902
8996
  this.addErrorElem();
8997
+ if (isNullOrUndefined(this.parent.rowDropSettings.targetID)) {
8998
+ this.removetopOrBottomBorder();
8999
+ this.removeChildBorder();
9000
+ }
8903
9001
  }
8904
9002
  }
8905
9003
  // To get the corresponding drop position related to mouse position
@@ -8974,6 +9072,11 @@ var RowDD = /** @__PURE__ @class */ (function () {
8974
9072
  }
8975
9073
  return this.dropPosition;
8976
9074
  };
9075
+ /**
9076
+ * Removes the visual border from all child rows within the TreeGrid.
9077
+ *
9078
+ * @returns {void} No return value.
9079
+ */
8977
9080
  RowDD.prototype.removeChildBorder = function () {
8978
9081
  var borderElem = [];
8979
9082
  borderElem = [].slice.call(this.parent.element.querySelectorAll('.e-childborder'));
@@ -8981,6 +9084,12 @@ var RowDD = /** @__PURE__ @class */ (function () {
8981
9084
  this.addRemoveClasses(borderElem, false, 'e-childborder');
8982
9085
  }
8983
9086
  };
9087
+ /**
9088
+ * Adds a visual border to the first row of the TreeGrid.
9089
+ *
9090
+ * @param {HTMLTableRowElement} targetRow - The target row element to which the border will be added, if it is the first row.
9091
+ * @returns {void} No return value.
9092
+ */
8984
9093
  RowDD.prototype.addFirstrowBorder = function (targetRow) {
8985
9094
  var node = this.parent.element;
8986
9095
  var tObj = this.parent;
@@ -9003,9 +9112,21 @@ var RowDD = /** @__PURE__ @class */ (function () {
9003
9112
  }
9004
9113
  }
9005
9114
  };
9115
+ /**
9116
+ * Adds a visual border to the last row of the TreeGrid.
9117
+ *
9118
+ * @param {HTMLTableRowElement} trElement - The table row element to which the border will be added, if it is the last row.
9119
+ * @returns {void} No return value.
9120
+ */
9006
9121
  RowDD.prototype.addLastRowborder = function (trElement) {
9122
+ if (!trElement) {
9123
+ return;
9124
+ }
9007
9125
  var isEmptyRow = trElement && (trElement.classList.contains('e-emptyrow') ||
9008
9126
  trElement.classList.contains('e-columnheader') || trElement.classList.contains('e-detailrow'));
9127
+ if (isEmptyRow) {
9128
+ return;
9129
+ }
9009
9130
  if (trElement && !isEmptyRow && this.parent.getRows()[this.parent.getCurrentViewRecords().length - 1].getAttribute('data-uid') ===
9010
9131
  trElement.getAttribute('data-uid')) {
9011
9132
  var bottomborder = this.parent.createElement('div', { className: 'e-lastrow-border' });
@@ -9018,40 +9139,55 @@ var RowDD = /** @__PURE__ @class */ (function () {
9018
9139
  }
9019
9140
  }
9020
9141
  };
9142
+ /**
9143
+ * Retrieves the total scroll width of the TreeGrid content area.
9144
+ *
9145
+ * @returns {number} The width of the scrollbar if content overflows, otherwise 0.
9146
+ */
9021
9147
  RowDD.prototype.getScrollWidth = function () {
9022
9148
  var scrollElem = this.parent.getContent().firstElementChild;
9023
9149
  return scrollElem.scrollWidth > scrollElem.offsetWidth ? Scroll.getScrollBarWidth() : 0;
9024
9150
  };
9151
+ /**
9152
+ * Adds an error element to the dragged row element during a row drag-and-drop operation.
9153
+ *
9154
+ * @returns {void} No return value.
9155
+ */
9025
9156
  RowDD.prototype.addErrorElem = function () {
9026
9157
  var dragelem = document.getElementsByClassName('e-cloneproperties')[0];
9027
- var errorelem = dragelem.querySelectorAll('.e-errorelem').length;
9158
+ var errorelemCount = dragelem.querySelectorAll('.e-errorelem').length;
9028
9159
  var sanitize = 'sanitize';
9029
- if (!errorelem && !this.parent.rowDropSettings.targetID) {
9030
- var ele = document.createElement('div');
9031
- classList(ele, ['e-errorcontainer'], []);
9032
- classList(ele, ['e-icons', 'e-errorelem'], []);
9160
+ if (!errorelemCount && !this.parent.rowDropSettings.targetID) {
9161
+ var errorContainer = document.createElement('div');
9162
+ errorContainer.classList.add('e-errorcontainer', 'e-icons', 'e-errorelem');
9163
+ var rowCell = dragelem.querySelector('.e-rowcell');
9033
9164
  var errorVal = dragelem.querySelector('.errorValue');
9034
- var content = dragelem.querySelector('.e-rowcell').innerHTML;
9165
+ var content = rowCell.innerHTML;
9035
9166
  if (errorVal) {
9036
9167
  content = this.parent["" + sanitize](errorVal.innerHTML);
9037
9168
  errorVal.parentNode.removeChild(errorVal);
9038
9169
  }
9039
- dragelem.querySelector('.e-rowcell').innerHTML = '';
9170
+ rowCell.innerHTML = '';
9040
9171
  var spanContent = document.createElement('span');
9041
9172
  spanContent.className = 'errorValue';
9042
9173
  spanContent.style.paddingLeft = '16px';
9043
9174
  spanContent.innerHTML = this.parent["" + sanitize](content);
9044
- dragelem.querySelector('.e-rowcell').appendChild(ele);
9045
- dragelem.querySelector('.e-rowcell').appendChild(spanContent);
9175
+ rowCell.appendChild(errorContainer);
9176
+ rowCell.appendChild(spanContent);
9046
9177
  var dropItemSpan = document.querySelector('.e-dropitemscount');
9047
9178
  if (this.hasDropItem && dropItemSpan) {
9048
- var dropItemLeft = parseInt(dropItemSpan.style.left, 10) + ele.offsetWidth + 16;
9179
+ var dropItemLeft = parseInt(dropItemSpan.style.left, 10) + errorContainer.offsetWidth + 16;
9049
9180
  var spanLeft = !this.parent.enableRtl ? dropItemLeft : 0;
9050
9181
  dropItemSpan.style.left = spanLeft + "px";
9051
9182
  this.hasDropItem = false;
9052
9183
  }
9053
9184
  }
9054
9185
  };
9186
+ /**
9187
+ * Removes the error element from the DOM and adjusts the position of the drop item count if necessary.
9188
+ *
9189
+ * @returns {void} No return value.
9190
+ */
9055
9191
  RowDD.prototype.removeErrorElem = function () {
9056
9192
  var errorelem = document.querySelector('.e-errorelem');
9057
9193
  var errorValue = document.querySelector('.errorValue');
@@ -9072,6 +9208,12 @@ var RowDD = /** @__PURE__ @class */ (function () {
9072
9208
  }
9073
9209
  this.hasDropItem = true;
9074
9210
  };
9211
+ /**
9212
+ * Applies drop border styles to row elements based on the current drop position ('topSegment' or 'bottomSegment').
9213
+ *
9214
+ * @param {Element} target - The target element where the drop action is taking place.
9215
+ * @returns {void} No return value.
9216
+ */
9075
9217
  RowDD.prototype.topOrBottomBorder = function (target) {
9076
9218
  var rowElement = [];
9077
9219
  var element = closest(target, 'tr');
@@ -9088,6 +9230,11 @@ var RowDD = /** @__PURE__ @class */ (function () {
9088
9230
  }
9089
9231
  }
9090
9232
  };
9233
+ /**
9234
+ * Removes the drop border classes ('e-dropbottom' and 'e-droptop') from the parent element if present.
9235
+ *
9236
+ * @returns {void} No return value.
9237
+ */
9091
9238
  RowDD.prototype.removetopOrBottomBorder = function () {
9092
9239
  var border = [];
9093
9240
  border = [].slice.call(this.parent.element.querySelectorAll('.e-dropbottom, .e-droptop'));
@@ -9096,6 +9243,14 @@ var RowDD = /** @__PURE__ @class */ (function () {
9096
9243
  this.addRemoveClasses(border, false, 'e-droptop');
9097
9244
  }
9098
9245
  };
9246
+ /**
9247
+ * Adds or removes a specified class from a list of HTML elements.
9248
+ *
9249
+ * @param {Element[]} cells - The list of HTML elements to which the class will be added or removed.
9250
+ * @param {boolean} add - A flag indicating whether to add (`true`) or remove (`false`) the class.
9251
+ * @param {string} className - The class name to be added or removed from each element in `cells`.
9252
+ * @returns {void} No return value.
9253
+ */
9099
9254
  RowDD.prototype.addRemoveClasses = function (cells, add, className) {
9100
9255
  for (var i = 0, len = cells.length; i < len; i++) {
9101
9256
  if (add) {
@@ -9106,6 +9261,12 @@ var RowDD = /** @__PURE__ @class */ (function () {
9106
9261
  }
9107
9262
  }
9108
9263
  };
9264
+ /**
9265
+ * Calculates the offset position of the specified HTML element relative to the document.
9266
+ *
9267
+ * @param {Element} element - The HTML element for which the offset position is calculated.
9268
+ * @returns {PositionOffSet} The offset position containing `top` and `left` values.
9269
+ */
9109
9270
  RowDD.prototype.getOffset = function (element) {
9110
9271
  var box = element.getBoundingClientRect();
9111
9272
  var body = document.body;
@@ -9118,35 +9279,38 @@ var RowDD = /** @__PURE__ @class */ (function () {
9118
9279
  var left = box.left + scrollLeft - clientLeft;
9119
9280
  return { top: Math.round(top), left: Math.round(left) };
9120
9281
  };
9282
+ /**
9283
+ * Handles the dragging of rows in the TreeGrid.
9284
+ *
9285
+ * @param {RowDragEventArgs} args - The event arguments for the row drag action.
9286
+ * @returns {void} This function does not return a value.
9287
+ */
9121
9288
  RowDD.prototype.Rowdraging = function (args) {
9122
9289
  var tObj = this.parent;
9123
9290
  var cloneElement = this.parent.element.querySelector('.e-cloneproperties');
9291
+ if (!cloneElement) {
9292
+ return;
9293
+ }
9124
9294
  cloneElement.style.cursor = '';
9125
9295
  var rowEle = args.target ? closest(args.target, 'tr') : null;
9126
9296
  var rowIdx = rowEle ? rowEle.rowIndex : -1;
9127
- var dragRecords = [];
9128
- var droppedRecord = tObj.getCurrentViewRecords()[parseInt(rowIdx.toString(), 10)];
9129
- this.removeErrorElem();
9130
- this.canDrop = true;
9131
- if (!args.data[0]) {
9132
- dragRecords.push(args.data);
9133
- }
9134
- else {
9135
- dragRecords = args.data;
9136
- }
9137
- if (rowIdx !== -1) {
9138
- this.ensuredropPosition(dragRecords, droppedRecord);
9139
- }
9140
- else {
9297
+ if (rowIdx === -1) {
9141
9298
  this.canDrop = false;
9142
9299
  this.addErrorElem();
9300
+ if (isNullOrUndefined(tObj.rowDropSettings.targetID)) {
9301
+ this.removetopOrBottomBorder();
9302
+ this.removeChildBorder();
9303
+ }
9304
+ return;
9143
9305
  }
9306
+ var dragRecords = Array.isArray(args.data) ? args.data : [args.data];
9307
+ var droppedRecord = tObj.getCurrentViewRecords()[parseInt(rowIdx.toString(), 10)];
9308
+ this.removeErrorElem();
9309
+ this.canDrop = true;
9310
+ this.ensuredropPosition(dragRecords, droppedRecord);
9144
9311
  if (!tObj.rowDropSettings.targetID && this.canDrop && !isNullOrUndefined(args.rows[0])) {
9145
9312
  tObj.rowDragAndDropModule.updateIcon(args.rows, rowIdx, args);
9146
9313
  }
9147
- if (isNullOrUndefined(tObj.rowDropSettings.targetID) && !this.canDrop) {
9148
- this.removetopOrBottomBorder();
9149
- }
9150
9314
  if (tObj.rowDropSettings.targetID) {
9151
9315
  var dropElement = parentsUntil(args.target, 'e-treegrid');
9152
9316
  if (dropElement && dropElement.id === this.parent.rowDropSettings.targetID) {
@@ -9161,17 +9325,26 @@ var RowDD = /** @__PURE__ @class */ (function () {
9161
9325
  }
9162
9326
  }
9163
9327
  };
9328
+ /**
9329
+ * Handles the row drop event for the TreeGrid.
9330
+ *
9331
+ * @param {RowDropEventArgs} args - The event arguments for the row drop action.
9332
+ * @returns {void} This function does not return a value.
9333
+ */
9164
9334
  RowDD.prototype.rowDropped = function (args) {
9165
9335
  var tObj = this.parent;
9166
9336
  var parentItem = 'parentItem';
9167
9337
  if (!tObj.rowDropSettings.targetID) {
9168
- if (parentsUntil(args.target, 'e-content')) {
9338
+ if (parentsUntil(args.target, 'e-content') || (this.dropPosition === 'Invalid' || !this.canDrop)) {
9169
9339
  if (this.parent.element.querySelector('.e-errorelem')) {
9170
9340
  this.dropPosition = 'Invalid';
9171
9341
  }
9172
9342
  setValue('dropPosition', this.dropPosition, args);
9173
9343
  tObj.trigger(rowDrop, args);
9174
9344
  if (!args.cancel) {
9345
+ if (!isCountRequired(this.parent) && this.dropPosition === 'Invalid') {
9346
+ return;
9347
+ }
9175
9348
  if (!isCountRequired(this.parent)) {
9176
9349
  this.dropRows(args);
9177
9350
  }
@@ -9179,9 +9352,7 @@ var RowDD = /** @__PURE__ @class */ (function () {
9179
9352
  tObj.flatData = this.orderToIndex(tObj.flatData);
9180
9353
  }
9181
9354
  tObj.grid.refresh();
9182
- if (!isNullOrUndefined(tObj.getHeaderContent().querySelector('.e-firstrow-border'))) {
9183
- tObj.getHeaderContent().querySelector('.e-firstrow-border').remove();
9184
- }
9355
+ this.removeRowBorders();
9185
9356
  }
9186
9357
  }
9187
9358
  }
@@ -9200,12 +9371,7 @@ var RowDD = /** @__PURE__ @class */ (function () {
9200
9371
  }
9201
9372
  this.removetopOrBottomBorder();
9202
9373
  this.removeChildBorder();
9203
- if (!isNullOrUndefined(this.parent.element.getElementsByClassName('e-firstrow-border')[0])) {
9204
- this.parent.element.getElementsByClassName('e-firstrow-border')[0].remove();
9205
- }
9206
- else if (!isNullOrUndefined(this.parent.element.getElementsByClassName('e-lastrow-border')[0])) {
9207
- this.parent.element.getElementsByClassName('e-lastrow-border')[0].remove();
9208
- }
9374
+ this.removeRowBorders();
9209
9375
  if (this.parent.enableImmutableMode && !this.parent.allowPaging && !isNullOrUndefined(args.data[0]["" + parentItem])) {
9210
9376
  var index = this.parent.treeColumnIndex;
9211
9377
  index = index + 1;
@@ -9247,6 +9413,26 @@ var RowDD = /** @__PURE__ @class */ (function () {
9247
9413
  }
9248
9414
  }
9249
9415
  };
9416
+ /**
9417
+ * Removes the border elements for the first and last rows of the TreeGrid.
9418
+ *
9419
+ * @returns {void} This function does not return a value.
9420
+ */
9421
+ RowDD.prototype.removeRowBorders = function () {
9422
+ var _this = this;
9423
+ ['e-firstrow-border', 'e-lastrow-border'].forEach(function (className) {
9424
+ var element = _this.parent.element.getElementsByClassName(className)[0];
9425
+ if (element) {
9426
+ element.remove();
9427
+ }
9428
+ });
9429
+ };
9430
+ /**
9431
+ * Handles the drag-and-drop operation between TreeGrids, updating the source and target grids.
9432
+ *
9433
+ * @param {RowDropEventArgs} args - The arguments related to the row drop event, including target information and data being dropped.
9434
+ * @returns {void} - This function does not return any value.
9435
+ */
9250
9436
  RowDD.prototype.dragDropGrid = function (args) {
9251
9437
  var tObj = this.parent;
9252
9438
  var targetRow = closest(args.target, 'tr');
@@ -9307,9 +9493,22 @@ var RowDD = /** @__PURE__ @class */ (function () {
9307
9493
  srcControl.grid.refresh();
9308
9494
  }
9309
9495
  };
9496
+ /**
9497
+ * Retrieves the index of the target row based on its 'data-rowindex' attribute.
9498
+ *
9499
+ * @param {Element} targetRow - The target row element from which to retrieve the index.
9500
+ * @returns {number} - The index of the target row, or 0 if the targetRow is null or undefined.
9501
+ */
9310
9502
  RowDD.prototype.getTargetIdx = function (targetRow) {
9311
9503
  return targetRow ? parseInt(targetRow.getAttribute('data-rowindex'), 10) : 0;
9312
9504
  };
9505
+ /**
9506
+ * Retrieves the parent data of a given record during a row drag-and-drop operation.
9507
+ *
9508
+ * @param {ITreeData} record - The record for which to retrieve the parent data.
9509
+ * @param {Object[]} [data] - Optional data array containing additional information related to the drop operation.
9510
+ * @returns {void} - This function does not return any value.
9511
+ */
9313
9512
  RowDD.prototype.getParentData = function (record, data) {
9314
9513
  var parentItem = record.parentItem;
9315
9514
  var selectedItemIndex = -1;
@@ -9337,6 +9536,13 @@ var RowDD = /** @__PURE__ @class */ (function () {
9337
9536
  }
9338
9537
  }
9339
9538
  };
9539
+ /**
9540
+ * Handles the row drop operation for the tree grid.
9541
+ *
9542
+ * @param {RowDropEventArgs} args - The event arguments containing details about the drop operation, including the target index and data.
9543
+ * @param {boolean} [isByMethod=false] - Optional flag indicating if the drop operation is triggered by a method.
9544
+ * @returns {void} - This function does not return any value.
9545
+ */
9340
9546
  RowDD.prototype.dropRows = function (args, isByMethod) {
9341
9547
  if (this.dropPosition !== 'Invalid' && !isRemoteData(this.parent)) {
9342
9548
  var tObj = this.parent;
@@ -9385,88 +9591,99 @@ var RowDD = /** @__PURE__ @class */ (function () {
9385
9591
  var _loop_1 = function (i) {
9386
9592
  draggedRecord_2 = dragRecords[parseInt(i.toString(), 10)];
9387
9593
  this_1.draggedRecord = draggedRecord_2;
9388
- if (this_1.dropPosition !== 'Invalid' && !isNullOrUndefined(this_1.droppedRecord)) {
9389
- if (!tObj.rowDropSettings.targetID || isByMethod) {
9390
- this_1.deleteDragRow();
9391
- }
9392
- if (this_1.draggedRecord === this_1.droppedRecord) {
9393
- var correctIndex = this_1.getTargetIdx(args.target.offsetParent.parentElement);
9394
- if (isNaN(correctIndex)) {
9395
- correctIndex = this_1.getTargetIdx(args.target.parentElement);
9594
+ if (!this_1.draggedRecord.hasChildRecords) {
9595
+ for (var _i = 0, dragRecords_2 = dragRecords; _i < dragRecords_2.length; _i++) {
9596
+ var dragRecord = dragRecords_2[_i];
9597
+ if (!isNullOrUndefined(dragRecord.childRecords) &&
9598
+ dragRecord.childRecords.indexOf(this_1.draggedRecord) !== -1) {
9599
+ this_1.draggedRecord = undefined;
9396
9600
  }
9397
- args.dropIndex = correctIndex;
9398
- droppedRecord = this_1.droppedRecord = this_1.parent.getCurrentViewRecords()[args.dropIndex];
9399
9601
  }
9400
- if (droppedRecord.parentItem || this_1.dropPosition === 'middleSegment') {
9401
- var parentRecords = tObj.parentData;
9402
- var newParentIndex = parentRecords.indexOf(this_1.draggedRecord);
9403
- if (newParentIndex !== -1) {
9404
- parentRecords.splice(newParentIndex, 1);
9602
+ }
9603
+ if (!isNullOrUndefined(this_1.draggedRecord)) {
9604
+ if (this_1.dropPosition !== 'Invalid' && !isNullOrUndefined(this_1.droppedRecord)) {
9605
+ if (!tObj.rowDropSettings.targetID || isByMethod) {
9606
+ this_1.deleteDragRow();
9405
9607
  }
9406
- }
9407
- var recordIndex1 = this_1.treeGridData.indexOf(droppedRecord);
9408
- this_1.dropAtTop(recordIndex1);
9409
- if (this_1.dropPosition === 'bottomSegment') {
9410
- if (!droppedRecord.hasChildRecords) {
9411
- if (this_1.parent.parentIdMapping) {
9412
- this_1.treeData.splice(recordIndex1 + 1, 0, this_1.draggedRecord.taskData);
9608
+ if (this_1.draggedRecord === this_1.droppedRecord) {
9609
+ var correctIndex = this_1.getTargetIdx(args.target.offsetParent.parentElement);
9610
+ if (isNaN(correctIndex)) {
9611
+ correctIndex = this_1.getTargetIdx(args.target.parentElement);
9413
9612
  }
9414
- this_1.treeGridData.splice(recordIndex1 + 1, 0, this_1.draggedRecord);
9613
+ args.dropIndex = correctIndex;
9614
+ droppedRecord = this_1.droppedRecord = this_1.parent.getCurrentViewRecords()[args.dropIndex];
9415
9615
  }
9416
- else {
9417
- count = this_1.getChildCount(droppedRecord, 0);
9418
- if (this_1.parent.parentIdMapping) {
9419
- this_1.treeData.splice(recordIndex1 + count + 1, 0, this_1.draggedRecord.taskData);
9616
+ if (droppedRecord.parentItem || this_1.dropPosition === 'middleSegment') {
9617
+ var parentRecords = tObj.parentData;
9618
+ var newParentIndex = parentRecords.indexOf(this_1.draggedRecord);
9619
+ if (newParentIndex !== -1) {
9620
+ parentRecords.splice(newParentIndex, 1);
9420
9621
  }
9421
- this_1.treeGridData.splice(recordIndex1 + count + 1, 0, this_1.draggedRecord);
9422
9622
  }
9423
- if (isNullOrUndefined(droppedRecord.parentItem)) {
9424
- delete draggedRecord_2.parentItem;
9425
- delete draggedRecord_2.parentUniqueID;
9426
- draggedRecord_2.level = 0;
9427
- if (this_1.parent.parentIdMapping) {
9428
- draggedRecord_2[this_1.parent.parentIdMapping] = null;
9623
+ var recordIndex1 = this_1.treeGridData.indexOf(droppedRecord);
9624
+ this_1.dropAtTop(recordIndex1);
9625
+ if (this_1.dropPosition === 'bottomSegment') {
9626
+ if (!droppedRecord.hasChildRecords) {
9627
+ if (this_1.parent.parentIdMapping) {
9628
+ this_1.treeData.splice(recordIndex1 + 1, 0, this_1.draggedRecord.taskData);
9629
+ }
9630
+ this_1.treeGridData.splice(recordIndex1 + 1, 0, this_1.draggedRecord);
9429
9631
  }
9430
- }
9431
- if (droppedRecord.parentItem) {
9432
- var rec = this_1.getChildrecordsByParentID(droppedRecord.parentUniqueID);
9433
- var childRecords = rec[0].childRecords;
9434
- var droppedRecordIndex = childRecords.indexOf(droppedRecord) + 1;
9435
- childRecords.splice(droppedRecordIndex, 0, draggedRecord_2);
9436
- draggedRecord_2.parentItem = droppedRecord.parentItem;
9437
- draggedRecord_2.parentUniqueID = droppedRecord.parentUniqueID;
9438
- draggedRecord_2.level = droppedRecord.level;
9439
- if (this_1.parent.parentIdMapping) {
9440
- draggedRecord_2[this_1.parent.parentIdMapping] = droppedRecord[this_1.parent.parentIdMapping];
9632
+ else {
9633
+ count = this_1.getChildCount(droppedRecord, 0);
9634
+ if (this_1.parent.parentIdMapping) {
9635
+ this_1.treeData.splice(recordIndex1 + count + 1, 0, this_1.draggedRecord.taskData);
9636
+ }
9637
+ this_1.treeGridData.splice(recordIndex1 + count + 1, 0, this_1.draggedRecord);
9638
+ }
9639
+ if (isNullOrUndefined(droppedRecord.parentItem)) {
9640
+ delete draggedRecord_2.parentItem;
9641
+ delete draggedRecord_2.parentUniqueID;
9642
+ draggedRecord_2.level = 0;
9643
+ if (this_1.parent.parentIdMapping) {
9644
+ draggedRecord_2[this_1.parent.parentIdMapping] = null;
9645
+ }
9646
+ }
9647
+ if (droppedRecord.parentItem) {
9648
+ var rec = this_1.getChildrecordsByParentID(droppedRecord.parentUniqueID);
9649
+ var childRecords = rec[0].childRecords;
9650
+ var droppedRecordIndex = childRecords.indexOf(droppedRecord) + 1;
9651
+ childRecords.splice(droppedRecordIndex, 0, draggedRecord_2);
9441
9652
  draggedRecord_2.parentItem = droppedRecord.parentItem;
9653
+ draggedRecord_2.parentUniqueID = droppedRecord.parentUniqueID;
9442
9654
  draggedRecord_2.level = droppedRecord.level;
9655
+ if (this_1.parent.parentIdMapping) {
9656
+ draggedRecord_2[this_1.parent.parentIdMapping] = droppedRecord[this_1.parent.parentIdMapping];
9657
+ draggedRecord_2.parentItem = droppedRecord.parentItem;
9658
+ draggedRecord_2.level = droppedRecord.level;
9659
+ }
9660
+ }
9661
+ if (draggedRecord_2.hasChildRecords) {
9662
+ var level = 1;
9663
+ this_1.updateChildRecordLevel(draggedRecord_2, level);
9664
+ this_1.updateChildRecord(draggedRecord_2, recordIndex1 + count + 1);
9443
9665
  }
9444
9666
  }
9445
- if (draggedRecord_2.hasChildRecords) {
9446
- var level = 1;
9447
- this_1.updateChildRecordLevel(draggedRecord_2, level);
9448
- this_1.updateChildRecord(draggedRecord_2, recordIndex1 + count + 1);
9449
- }
9667
+ this_1.dropMiddle(recordIndex1);
9450
9668
  }
9451
- this_1.dropMiddle(recordIndex1);
9452
- }
9453
- if (isNullOrUndefined(draggedRecord_2.parentItem)) {
9454
- var parentRecords = tObj.parentData;
9455
- var newParentIndex = parentRecords.indexOf(this_1.droppedRecord);
9456
- var nonRepeat_1 = 0;
9457
- parentRecords.filter(function (e) {
9458
- if (draggedRecord_2.uniqueID === e.uniqueID) {
9459
- nonRepeat_1++;
9669
+ if (isNullOrUndefined(draggedRecord_2.parentItem)) {
9670
+ var parentRecords = tObj.parentData;
9671
+ var newParentIndex = parentRecords.indexOf(this_1.droppedRecord);
9672
+ var nonRepeat_1 = 0;
9673
+ parentRecords.filter(function (e) {
9674
+ if (draggedRecord_2.uniqueID === e.uniqueID) {
9675
+ nonRepeat_1++;
9676
+ }
9677
+ });
9678
+ if (this_1.dropPosition === 'bottomSegment' && nonRepeat_1 === 0) {
9679
+ parentRecords.splice(newParentIndex + 1, 0, draggedRecord_2);
9680
+ }
9681
+ else if (this_1.dropPosition === 'topSegment' && nonRepeat_1 === 0) {
9682
+ parentRecords.splice(newParentIndex, 0, draggedRecord_2);
9460
9683
  }
9461
- });
9462
- if (this_1.dropPosition === 'bottomSegment' && nonRepeat_1 === 0) {
9463
- parentRecords.splice(newParentIndex + 1, 0, draggedRecord_2);
9464
- }
9465
- else if (this_1.dropPosition === 'topSegment' && nonRepeat_1 === 0) {
9466
- parentRecords.splice(newParentIndex, 0, draggedRecord_2);
9467
9684
  }
9685
+ tObj.rowDragAndDropModule.refreshGridDataSource();
9468
9686
  }
9469
- tObj.rowDragAndDropModule.refreshGridDataSource();
9470
9687
  };
9471
9688
  var this_1 = this;
9472
9689
  for (var i = 0; i < dragLength; i++) {
@@ -9474,6 +9691,12 @@ var RowDD = /** @__PURE__ @class */ (function () {
9474
9691
  }
9475
9692
  }
9476
9693
  };
9694
+ /**
9695
+ * Handles the logic for inserting a dragged record into the middle of a parent record's child records.
9696
+ *
9697
+ * @param {number} recordIndex - The index at which to insert the dragged record relative to the parent record's child records.
9698
+ * @returns {void} - This function does not return any value.
9699
+ */
9477
9700
  RowDD.prototype.dropMiddle = function (recordIndex) {
9478
9701
  var tObj = this.parent;
9479
9702
  var childRecords = findChildrenRecords(this.droppedRecord);
@@ -9494,15 +9717,23 @@ var RowDD = /** @__PURE__ @class */ (function () {
9494
9717
  }
9495
9718
  }
9496
9719
  };
9720
+ /**
9721
+ * Handles the logic for inserting a dragged record at the top of a parent record's child records.
9722
+ *
9723
+ * @param {number} recordIndex1 - The index at which to insert the dragged record in the tree grid data.
9724
+ * @returns {void} - This function does not return any value.
9725
+ */
9497
9726
  RowDD.prototype.dropAtTop = function (recordIndex1) {
9498
9727
  var tObj = this.parent;
9499
9728
  if (this.dropPosition === 'topSegment') {
9500
9729
  if (tObj.parentIdMapping) {
9501
9730
  this.treeData.splice(recordIndex1, 0, this.draggedRecord.taskData);
9502
9731
  }
9503
- this.draggedRecord.parentItem = this.treeGridData[parseInt(recordIndex1.toString(), 10)].parentItem;
9504
- this.draggedRecord.parentUniqueID = this.treeGridData[parseInt(recordIndex1.toString(), 10)].parentUniqueID;
9505
- this.draggedRecord.level = this.treeGridData[parseInt(recordIndex1.toString(), 10)].level;
9732
+ var targetRecord = this.treeGridData[parseInt(recordIndex1.toString(), 10)];
9733
+ this.draggedRecord.parentItem = targetRecord.parentItem;
9734
+ this.draggedRecord.parentUniqueID = targetRecord.parentUniqueID;
9735
+ this.draggedRecord.level = targetRecord.level;
9736
+ // Insert dragged record into the grid data
9506
9737
  this.treeGridData.splice(parseInt(recordIndex1.toString(), 10), 0, this.draggedRecord);
9507
9738
  if (this.draggedRecord.hasChildRecords) {
9508
9739
  var level = 1;
@@ -9513,10 +9744,16 @@ var RowDD = /** @__PURE__ @class */ (function () {
9513
9744
  var rec = this.getChildrecordsByParentID(this.droppedRecord.parentUniqueID);
9514
9745
  var childRecords = rec[0].childRecords;
9515
9746
  var droppedRecordIndex = childRecords.indexOf(this.droppedRecord);
9747
+ // Insert the dragged record into the child records at the appropriate position
9516
9748
  childRecords.splice(droppedRecordIndex, 0, this.draggedRecord);
9517
9749
  }
9518
9750
  }
9519
9751
  };
9752
+ /**
9753
+ * Updates the level and hierarchy of the dragged record based on the drop position.
9754
+ *
9755
+ * @returns {void} - This function does not return any value.
9756
+ */
9520
9757
  RowDD.prototype.recordLevel = function () {
9521
9758
  var tObj = this.parent;
9522
9759
  var draggedRecord = this.draggedRecord;
@@ -9538,6 +9775,7 @@ var RowDD = /** @__PURE__ @class */ (function () {
9538
9775
  draggedRecord.parentItem = parentItem;
9539
9776
  draggedRecord.parentUniqueID = droppedRecord.uniqueID;
9540
9777
  droppedRecord.childRecords.splice(droppedRecord.childRecords.length, 0, draggedRecord);
9778
+ setValue('uniqueIDCollection.' + draggedRecord.uniqueID, draggedRecord, tObj);
9541
9779
  var isSelfReference = 'isSelfReference';
9542
9780
  if (tObj["" + isSelfReference]) {
9543
9781
  droppedRecord[tObj.childMapping] = [];
@@ -9557,6 +9795,11 @@ var RowDD = /** @__PURE__ @class */ (function () {
9557
9795
  droppedRecord.expanded = true;
9558
9796
  }
9559
9797
  };
9798
+ /**
9799
+ * Deletes the currently dragged row from the TreeGrid.
9800
+ *
9801
+ * @returns {void} - This function does not return any value.
9802
+ */
9560
9803
  RowDD.prototype.deleteDragRow = function () {
9561
9804
  if (this.parent.dataSource instanceof DataManager && isOffline(this.parent)) {
9562
9805
  this.treeGridData = this.parent.grid.dataSource.dataSource.json;
@@ -9572,6 +9815,13 @@ var RowDD = /** @__PURE__ @class */ (function () {
9572
9815
  }
9573
9816
  this.removeRecords(deletedRow);
9574
9817
  };
9818
+ /**
9819
+ * Updates the child records of a specified parent record in the TreeGrid.
9820
+ *
9821
+ * @param {ITreeData} record - The parent record whose child records will be updated.
9822
+ * @param {number} count - The initial count to keep track of record positioning.
9823
+ * @returns {number} - The updated count after processing all child records.
9824
+ */
9575
9825
  RowDD.prototype.updateChildRecord = function (record, count) {
9576
9826
  var currentRecord;
9577
9827
  var tObj = this.parent;
@@ -9599,6 +9849,13 @@ var RowDD = /** @__PURE__ @class */ (function () {
9599
9849
  }
9600
9850
  return count;
9601
9851
  };
9852
+ /**
9853
+ * Updates the level of child records for a specified parent record in the TreeGrid.
9854
+ *
9855
+ * @param {ITreeData} record - The parent record whose child records' levels will be updated.
9856
+ * @param {number} level - The current level of the parent record.
9857
+ * @returns {number} - The updated level after processing all child records.
9858
+ */
9602
9859
  RowDD.prototype.updateChildRecordLevel = function (record, level) {
9603
9860
  var length = 0;
9604
9861
  var currentRecord;
@@ -9629,6 +9886,12 @@ var RowDD = /** @__PURE__ @class */ (function () {
9629
9886
  }
9630
9887
  return level;
9631
9888
  };
9889
+ /**
9890
+ * Removes specified records from the TreeGrid data source.
9891
+ *
9892
+ * @param {ITreeData} record - The record to be removed, including any child records if applicable.
9893
+ * @returns {void} - This method does not return a value.
9894
+ */
9632
9895
  RowDD.prototype.removeRecords = function (record) {
9633
9896
  var tObj = this.parent;
9634
9897
  var dataSource;
@@ -9711,6 +9974,12 @@ var RowDD = /** @__PURE__ @class */ (function () {
9711
9974
  }
9712
9975
  }
9713
9976
  };
9977
+ /**
9978
+ * Updates the records in the TreeGrid data source that have been modified.
9979
+ *
9980
+ * @param {ITreeData} record - The record to update, along with its parent records if applicable.
9981
+ * @returns {void} - This method does not return a value.
9982
+ */
9714
9983
  RowDD.prototype.updateModifiedRecords = function (record) {
9715
9984
  var parentData = getParentData(this.parent, record.parentUniqueID);
9716
9985
  if (!isNullOrUndefined(parentData)) {
@@ -9718,6 +9987,12 @@ var RowDD = /** @__PURE__ @class */ (function () {
9718
9987
  this.updateModifiedRecords(parentData);
9719
9988
  }
9720
9989
  };
9990
+ /**
9991
+ * Recursively removes child records from the specified record and updates the data source.
9992
+ *
9993
+ * @param {ITreeData} record - The parent record whose child records are to be removed.
9994
+ * @returns {void} - This method does not return a value.
9995
+ */
9721
9996
  RowDD.prototype.removeChildItem = function (record) {
9722
9997
  var currentRecord;
9723
9998
  var idx;
@@ -9764,6 +10039,13 @@ var RowDD = /** @__PURE__ @class */ (function () {
9764
10039
  }
9765
10040
  }
9766
10041
  };
10042
+ /**
10043
+ * Retrieves the count of child records associated with the specified parent record.
10044
+ *
10045
+ * @param {ITreeData} record - The parent record for which child count is to be calculated.
10046
+ * @param {number} count - The initial count to start with, usually passed as 0.
10047
+ * @returns {number} - The total count of child records.
10048
+ */
9767
10049
  RowDD.prototype.getChildCount = function (record, count) {
9768
10050
  var currentRecord;
9769
10051
  if (!record.hasChildRecords) {
@@ -9778,6 +10060,14 @@ var RowDD = /** @__PURE__ @class */ (function () {
9778
10060
  }
9779
10061
  return count;
9780
10062
  };
10063
+ /**
10064
+ * Ensures the validity of the drop position for the dragged records by verifying the hierarchy and position constraints.
10065
+ * If the current record is found in the dragged records' children, sets the drop position to 'Invalid'.
10066
+ *
10067
+ * @param {ITreeData[]} draggedRecords - The array of dragged records being verified.
10068
+ * @param {ITreeData} currentRecord - The current record to check against dragged records.
10069
+ * @returns {void} - This function does not return a value.
10070
+ */
9781
10071
  RowDD.prototype.ensuredropPosition = function (draggedRecords, currentRecord) {
9782
10072
  var _this = this;
9783
10073
  draggedRecords.filter(function (e) {
@@ -9790,11 +10080,29 @@ var RowDD = /** @__PURE__ @class */ (function () {
9790
10080
  _this.dropPosition = 'Invalid';
9791
10081
  _this.addErrorElem();
9792
10082
  _this.canDrop = false;
10083
+ if (isNullOrUndefined(_this.parent.rowDropSettings.targetID)) {
10084
+ _this.removetopOrBottomBorder();
10085
+ _this.removeChildBorder();
10086
+ }
9793
10087
  return;
9794
10088
  }
9795
10089
  }
9796
10090
  });
9797
10091
  };
10092
+ RowDD.prototype.isDuplicateData = function (currentData) {
10093
+ var primaryKeys = this.parent.getPrimaryKeyFieldNames();
10094
+ if (primaryKeys.length === 0) {
10095
+ return false;
10096
+ }
10097
+ return this.parent.flatData.some(function (data) {
10098
+ // eslint-disable-next-line
10099
+ return primaryKeys.every(function (key) { return data[key] === currentData[key]; });
10100
+ });
10101
+ };
10102
+ /**
10103
+ * Cleans up resources, event listeners, and DOM elements when the TreeGrid component is destroyed.
10104
+ * @returns {void}
10105
+ */
9798
10106
  RowDD.prototype.destroy = function () {
9799
10107
  this.removeEventListener();
9800
10108
  };
@@ -11435,7 +11743,9 @@ var ContextMenu = /** @__PURE__ @class */ (function () {
11435
11743
  for (var _b = 0, _c = args.items; _b < _c.length; _b++) {
11436
11744
  var items = _c[_b];
11437
11745
  if (items.text === 'Outdent' || items.text === 'Indent') {
11438
- tObj.grid.contextMenuModule['hiddenItems'].push(items.text);
11746
+ if (!tObj.grid.contextMenuModule['hiddenItems'].includes(items.text)) {
11747
+ tObj.grid.contextMenuModule['hiddenItems'].push(items.text);
11748
+ }
11439
11749
  }
11440
11750
  }
11441
11751
  tObj.grid.contextMenuModule.contextMenu.hideItems(tObj.grid.contextMenuModule['hiddenItems']);
@@ -11625,69 +11935,71 @@ var BatchEdit = /** @__PURE__ @class */ (function () {
11625
11935
  this.batchAddRowRecord = extendArray(this.batchAddRowRecord);
11626
11936
  this.batchAddRowRecord.push(this.batchRecords[this.addRowIndex]);
11627
11937
  added = this.parent.grid.getRowsObject()[parseInt(rowObjectIndex.toString(), 10)].changes;
11628
- added.uniqueID = getUid(this.parent.element.id + '_data_');
11629
- setValue('uniqueIDCollection.' + added.uniqueID, added, this.parent);
11630
- if (!Object.prototype.hasOwnProperty.call(added, 'level')) {
11631
- this.batchIndex = this.selectedIndex === -1 ? 0 : this.batchIndex;
11632
- if (this.parent.editSettings.newRowPosition === 'Child') {
11633
- added.primaryParent = parentRecord;
11634
- if (this.selectedIndex > -1) {
11635
- added.parentItem = extend$1({}, this.batchRecords[this.addRowIndex]);
11636
- added.parentUniqueID = added.parentItem.uniqueID;
11637
- delete added.parentItem.childRecords;
11638
- delete added.parentItem[this.parent.childMapping];
11639
- added.level = added.parentItem.level + 1;
11640
- added.index = this.batchIndex;
11641
- var childRecordCount = findChildrenRecords(this.batchRecords[this.addRowIndex]).length;
11642
- var record = findChildrenRecords(this.batchRecords[this.addRowIndex])[childRecordCount - 1];
11643
- record = isNullOrUndefined(record) ? this.batchRecords[this.addRowIndex] : record;
11644
- currentDataIndex = data.map(function (e) { return e["" + primaryKey_1]; }).indexOf(record["" + primaryKey_1]);
11645
- if (this.isSelfReference) {
11646
- added[this.parent.parentIdMapping] = idMapping;
11938
+ if (!isNullOrUndefined(added)) {
11939
+ added.uniqueID = getUid(this.parent.element.id + '_data_');
11940
+ setValue('uniqueIDCollection.' + added.uniqueID, added, this.parent);
11941
+ if (!Object.prototype.hasOwnProperty.call(added, 'level')) {
11942
+ this.batchIndex = this.selectedIndex === -1 ? 0 : this.batchIndex;
11943
+ if (this.parent.editSettings.newRowPosition === 'Child') {
11944
+ added.primaryParent = parentRecord;
11945
+ if (this.selectedIndex > -1) {
11946
+ added.parentItem = extend$1({}, this.batchRecords[this.addRowIndex]);
11947
+ added.parentUniqueID = added.parentItem.uniqueID;
11948
+ delete added.parentItem.childRecords;
11949
+ delete added.parentItem[this.parent.childMapping];
11950
+ added.level = added.parentItem.level + 1;
11951
+ added.index = this.batchIndex;
11952
+ var childRecordCount = findChildrenRecords(this.batchRecords[this.addRowIndex]).length;
11953
+ var record = findChildrenRecords(this.batchRecords[this.addRowIndex])[childRecordCount - 1];
11954
+ record = isNullOrUndefined(record) ? this.batchRecords[this.addRowIndex] : record;
11955
+ currentDataIndex = data.map(function (e) { return e["" + primaryKey_1]; }).indexOf(record["" + primaryKey_1]);
11956
+ if (this.isSelfReference) {
11957
+ added[this.parent.parentIdMapping] = idMapping;
11958
+ }
11959
+ updateParentRow(primaryKey_1, added.parentItem, 'add', this.parent, this.isSelfReference, added);
11647
11960
  }
11648
- updateParentRow(primaryKey_1, added.parentItem, 'add', this.parent, this.isSelfReference, added);
11649
11961
  }
11650
- }
11651
- else if ((this.parent.editSettings.newRowPosition === 'Above' || this.parent.editSettings.newRowPosition === 'Below')
11652
- && !isNullOrUndefined(this.batchRecords[this.addRowIndex])) {
11653
- added.level = this.batchRecords[parseInt(this.addRowIndex.toString(), 10)]["" + level];
11654
- if (added.level && this.selectedIndex > -1) {
11655
- added.parentItem = parentRecord;
11656
- added.parentUniqueID = parentUniqueID;
11657
- delete added.parentItem.childRecords;
11658
- delete added.parentItem[this.parent.childMapping];
11962
+ else if ((this.parent.editSettings.newRowPosition === 'Above' || this.parent.editSettings.newRowPosition === 'Below')
11963
+ && !isNullOrUndefined(this.batchRecords[this.addRowIndex])) {
11964
+ added.level = this.batchRecords[parseInt(this.addRowIndex.toString(), 10)]["" + level];
11965
+ if (added.level && this.selectedIndex > -1) {
11966
+ added.parentItem = parentRecord;
11967
+ added.parentUniqueID = parentUniqueID;
11968
+ delete added.parentItem.childRecords;
11969
+ delete added.parentItem[this.parent.childMapping];
11970
+ }
11971
+ added.index = this.parent.editSettings.newRowPosition === 'Below' ? this.batchIndex : this.batchIndex - 1;
11972
+ if (this.parent.editSettings.newRowPosition === 'Below' && this.selectedIndex > -1) {
11973
+ var childRecordCount = findChildrenRecords(this.batchRecords[this.addRowIndex]).length;
11974
+ var record = findChildrenRecords(this.batchRecords[this.addRowIndex])[childRecordCount - 1];
11975
+ record = isNullOrUndefined(record) ? this.batchRecords[this.addRowIndex] : record;
11976
+ currentDataIndex = data.map(function (e) { return e["" + primaryKey_1]; }).indexOf(record["" + primaryKey_1]);
11977
+ }
11978
+ if (this.parent.editSettings.newRowPosition === 'Above' && this.selectedIndex > -1) {
11979
+ var record = this.batchRecords[this.addRowIndex];
11980
+ currentDataIndex = data.map(function (e) { return e["" + primaryKey_1]; }).indexOf(record["" + primaryKey_1]);
11981
+ }
11982
+ if (this.isSelfReference) {
11983
+ added[this.parent.parentIdMapping] = parentIdMapping;
11984
+ }
11659
11985
  }
11660
- added.index = this.parent.editSettings.newRowPosition === 'Below' ? this.batchIndex : this.batchIndex - 1;
11661
- if (this.parent.editSettings.newRowPosition === 'Below' && this.selectedIndex > -1) {
11662
- var childRecordCount = findChildrenRecords(this.batchRecords[this.addRowIndex]).length;
11663
- var record = findChildrenRecords(this.batchRecords[this.addRowIndex])[childRecordCount - 1];
11664
- record = isNullOrUndefined(record) ? this.batchRecords[this.addRowIndex] : record;
11665
- currentDataIndex = data.map(function (e) { return e["" + primaryKey_1]; }).indexOf(record["" + primaryKey_1]);
11986
+ added.index = added.index === -1 ? 0 : added.index;
11987
+ added.hasChildRecords = false;
11988
+ added.childRecords = [];
11989
+ this.batchRecords.splice(added.index, 0, added);
11990
+ this.currentViewRecords.splice(added.index, 0, added);
11991
+ if (currentDataIndex) {
11992
+ indexvalue = currentDataIndex;
11666
11993
  }
11667
- if (this.parent.editSettings.newRowPosition === 'Above' && this.selectedIndex > -1) {
11668
- var record = this.batchRecords[this.addRowIndex];
11669
- currentDataIndex = data.map(function (e) { return e["" + primaryKey_1]; }).indexOf(record["" + primaryKey_1]);
11994
+ else {
11995
+ indexvalue = added.index;
11670
11996
  }
11671
- if (this.isSelfReference) {
11672
- added[this.parent.parentIdMapping] = parentIdMapping;
11997
+ if (this.parent.editSettings.newRowPosition !== 'Above') {
11998
+ indexvalue = added.index === 0 ? indexvalue : indexvalue + 1;
11673
11999
  }
12000
+ data.splice(indexvalue, 0, added);
12001
+ this.batchAddedRecords.push(added);
11674
12002
  }
11675
- added.index = added.index === -1 ? 0 : added.index;
11676
- added.hasChildRecords = false;
11677
- added.childRecords = [];
11678
- this.batchRecords.splice(added.index, 0, added);
11679
- this.currentViewRecords.splice(added.index, 0, added);
11680
- if (currentDataIndex) {
11681
- indexvalue = currentDataIndex;
11682
- }
11683
- else {
11684
- indexvalue = added.index;
11685
- }
11686
- if (this.parent.editSettings.newRowPosition !== 'Above') {
11687
- indexvalue = added.index === 0 ? indexvalue : indexvalue + 1;
11688
- }
11689
- data.splice(indexvalue, 0, added);
11690
- this.batchAddedRecords.push(added);
11691
12003
  }
11692
12004
  this.parent.grid.getRowsObject()[parseInt(rowObjectIndex.toString(), 10)].data = added;
11693
12005
  this.newBatchRowAdded = false;
@@ -13757,9 +14069,15 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
13757
14069
  firsttdinx = +attr; // this.parent.getContent().querySelector('.e-content tr').getAttribute('data-rowindex');
13758
14070
  }
13759
14071
  if (firsttdinx === 0) {
13760
- this.translateY = !isNullOrUndefined(this.endIndex) ?
13761
- (this.endIndex - this.parent.pageSettings.pageSize) * (this.parent.rowHeight ?
13762
- this.parent.rowHeight : this.parent.getRowHeight()) : 0;
14072
+ if (this.endIndex - this.startIndex < this.parent.pageSettings.pageSize) {
14073
+ this.translateY = !isNullOrUndefined(this.endIndex) ?
14074
+ (this.endIndex - this.parent.pageSettings.pageSize) * (this.parent.rowHeight ?
14075
+ this.parent.rowHeight : this.parent.getRowHeight()) : 0;
14076
+ }
14077
+ else {
14078
+ this.translateY = (scrollArgs.offset.top - (outBuffer * rowHeight) > 0) ?
14079
+ scrollArgs.offset.top - (outBuffer * rowHeight) + rowHeight : 0;
14080
+ }
13763
14081
  }
13764
14082
  else if (this.parent.getFrozenColumns() > 0) {
13765
14083
  scrollArgs.offset.top = scrollArgs.offset.top + 80;
@@ -13793,6 +14111,10 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
13793
14111
  ((this.startIndex - currentViewData[0]["" + indexValue]) < (this.parent.pageSettings.pageSize / 2)) && this.parent.selectionModule.isRowSelected) {
13794
14112
  this.startIndex = currentViewData[0]["" + indexValue] + (this.parent.pageSettings.pageSize / 2);
13795
14113
  }
14114
+ if (this.parent.root.isSelfReference) {
14115
+ var selectedIndex = this.parent.root.selectedRowIndex;
14116
+ this.startIndex = selectedIndex !== -1 && selectedIndex !== this.startIndex ? this.startIndex - 1 : this.startIndex;
14117
+ }
13796
14118
  if (scrollArgs.offset.top > (rowHeight * this.totalRecords)) {
13797
14119
  this.translateY = this.getTranslateY(scrollArgs.offset.top, content.getBoundingClientRect().height);
13798
14120
  }
@@ -13801,10 +14123,7 @@ var VirtualTreeContentRenderer = /** @__PURE__ @class */ (function (_super) {
13801
14123
  this.translateY = (this.totalRecords * rowHeight) - ((this.endIndex - this.startIndex) * rowHeight);
13802
14124
  }
13803
14125
  else {
13804
- if (this.parent.allowRowDragAndDrop) {
13805
- this.translateY = scrollArgs.offset.top - rowHeight * 2;
13806
- }
13807
- else if (this.parent.getFrozenColumns() > 0) {
14126
+ if (this.parent.getFrozenColumns() > 0) {
13808
14127
  this.translateY = scrollArgs.offset.top - ((rowHeight * 2) + this.parent.pageSettings.pageSize);
13809
14128
  }
13810
14129
  else {
@@ -14175,6 +14494,11 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
14175
14494
  (startIndex < this.parent.getRows().length && endIndex <= startIndex + this.parent.getRows().length) && translateY === 0) {
14176
14495
  startIndex = 0;
14177
14496
  }
14497
+ if ((pageingDetails.actionArgs.requestType === 'save' && startIndex !== this.prevstartIndex) &&
14498
+ (startIndex < this.parent.getRows().length && endIndex <= startIndex + this.parent.getRows().length) && translateY === 0) {
14499
+ startIndex = 0;
14500
+ endIndex = startIndex + this.parent.grid.pageSettings.pageSize;
14501
+ }
14178
14502
  if (!isNullOrUndefined(this.expandCollapseRec)) {
14179
14503
  var resourceCount = this.parent.getRows();
14180
14504
  var sIndex = visualData.indexOf(this.expandCollapseRec);