@syncfusion/ej2-treegrid 28.2.4 → 29.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 (84) hide show
  1. package/README.md +2 -2
  2. package/dist/ej2-treegrid.min.js +2 -2
  3. package/dist/ej2-treegrid.umd.min.js +2 -2
  4. package/dist/ej2-treegrid.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-treegrid.es2015.js +1275 -519
  6. package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
  7. package/dist/es6/ej2-treegrid.es5.js +1277 -519
  8. package/dist/es6/ej2-treegrid.es5.js.map +1 -1
  9. package/dist/global/ej2-treegrid.min.js +2 -2
  10. package/dist/global/ej2-treegrid.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +10 -10
  13. package/src/treegrid/actions/batch-edit.js +12 -5
  14. package/src/treegrid/actions/edit.js +12 -12
  15. package/src/treegrid/actions/page.js +1 -1
  16. package/src/treegrid/actions/rowdragdrop.d.ts +21 -1
  17. package/src/treegrid/actions/rowdragdrop.js +248 -48
  18. package/src/treegrid/actions/summary.js +1 -1
  19. package/src/treegrid/actions/virtual-scroll.d.ts +34 -1
  20. package/src/treegrid/actions/virtual-scroll.js +58 -11
  21. package/src/treegrid/base/constant.d.ts +0 -4
  22. package/src/treegrid/base/constant.js +0 -4
  23. package/src/treegrid/base/data.js +48 -47
  24. package/src/treegrid/base/treegrid-model.d.ts +195 -208
  25. package/src/treegrid/base/treegrid.d.ts +598 -411
  26. package/src/treegrid/base/treegrid.js +523 -306
  27. package/src/treegrid/enum.d.ts +77 -80
  28. package/src/treegrid/enum.js +2 -2
  29. package/src/treegrid/models/column.d.ts +122 -177
  30. package/src/treegrid/models/column.js +14 -26
  31. package/src/treegrid/models/edit-settings-model.d.ts +24 -25
  32. package/src/treegrid/models/edit-settings.d.ts +25 -26
  33. package/src/treegrid/models/edit-settings.js +1 -1
  34. package/src/treegrid/models/filter-settings-model.d.ts +41 -49
  35. package/src/treegrid/models/filter-settings.d.ts +43 -51
  36. package/src/treegrid/models/filter-settings.js +2 -2
  37. package/src/treegrid/models/infinite-scroll-settings-model.d.ts +4 -4
  38. package/src/treegrid/models/infinite-scroll-settings.d.ts +4 -4
  39. package/src/treegrid/models/infinite-scroll-settings.js +1 -1
  40. package/src/treegrid/models/loading-indicator-model.d.ts +3 -4
  41. package/src/treegrid/models/loading-indicator.d.ts +4 -4
  42. package/src/treegrid/models/loading-indicator.js +1 -1
  43. package/src/treegrid/models/page-settings-model.d.ts +10 -13
  44. package/src/treegrid/models/page-settings.d.ts +11 -14
  45. package/src/treegrid/models/page-settings.js +1 -1
  46. package/src/treegrid/models/rowdrop-settings-model.d.ts +1 -1
  47. package/src/treegrid/models/rowdrop-settings.d.ts +13 -6
  48. package/src/treegrid/models/rowdrop-settings.js +1 -1
  49. package/src/treegrid/models/search-settings-model.d.ts +13 -11
  50. package/src/treegrid/models/search-settings.d.ts +14 -12
  51. package/src/treegrid/models/search-settings.js +1 -1
  52. package/src/treegrid/models/selection-settings-model.d.ts +18 -29
  53. package/src/treegrid/models/selection-settings.d.ts +18 -29
  54. package/src/treegrid/models/sort-settings-model.d.ts +8 -5
  55. package/src/treegrid/models/sort-settings.d.ts +10 -7
  56. package/src/treegrid/models/sort-settings.js +2 -2
  57. package/src/treegrid/models/summary-model.d.ts +28 -29
  58. package/src/treegrid/models/summary.d.ts +32 -30
  59. package/src/treegrid/models/summary.js +4 -1
  60. package/src/treegrid/models/textwrap-settings-model.d.ts +7 -4
  61. package/src/treegrid/models/textwrap-settings.d.ts +8 -5
  62. package/src/treegrid/models/textwrap-settings.js +1 -1
  63. package/src/treegrid/renderer/render.js +11 -5
  64. package/src/treegrid/renderer/virtual-row-model-generator.js +5 -4
  65. package/src/treegrid/renderer/virtual-tree-content-render.d.ts +277 -0
  66. package/src/treegrid/renderer/virtual-tree-content-render.js +328 -35
  67. package/src/treegrid/utils.d.ts +1 -1
  68. package/styles/bootstrap-lite.css +0 -12
  69. package/styles/bootstrap.css +0 -12
  70. package/styles/bootstrap5-dark-lite.css +1 -1
  71. package/styles/bootstrap5-dark.css +1 -1
  72. package/styles/treegrid/_layout.scss +0 -1
  73. package/styles/treegrid/_material-dark-definition.scss +2 -2
  74. package/styles/treegrid/_material-definition.scss +2 -2
  75. package/styles/treegrid/bootstrap.css +0 -12
  76. package/styles/treegrid/bootstrap5-dark.css +1 -1
  77. package/styles/treegrid/icons/_bootstrap.scss +0 -17
  78. package/styles/treegrid/icons/_bootstrap5.scss +1 -1
  79. package/styles/treegrid/icons/_fabric-dark.scss +1 -1
  80. package/styles/treegrid/icons/_fabric.scss +1 -1
  81. package/styles/treegrid/icons/_fluent2.scss +1 -1
  82. package/styles/treegrid/icons/_fusionnew.scss +1 -0
  83. package/styles/treegrid/icons/_highcontrast-light.scss +1 -1
  84. package/styles/treegrid/icons/_tailwind-dark.scss +2 -2
@@ -93,7 +93,6 @@ var RowDD = /** @class */ (function () {
93
93
  }
94
94
  var action = 'action';
95
95
  var dropPosition = 'dropPosition';
96
- var updateRowAndCellElements = 'updateRowAndCellElements';
97
96
  if (fromIndexes[0] !== toIndex && ['above', 'below', 'child'].indexOf(position) !== -1) {
98
97
  if (position === 'above') {
99
98
  this.dropPosition = 'topSegment';
@@ -143,7 +142,7 @@ var RowDD = /** @class */ (function () {
143
142
  var parentrow = this.parent.getRows()[parseInt(toIndex.toString(), 10)];
144
143
  totalRecord.push(parentData);
145
144
  rows.push(parentrow);
146
- this.parent["" + updateRowAndCellElements](totalRecord, rows, index);
145
+ this.updateRowAndCellElements(totalRecord, rows, index);
147
146
  }
148
147
  if (this.parent.enableImmutableMode && this.parent["" + action] === 'outdenting') {
149
148
  var index = this.parent.allowRowDragAndDrop
@@ -155,7 +154,29 @@ var RowDD = /** @class */ (function () {
155
154
  var rows = [];
156
155
  totalRecord.push(record);
157
156
  rows.push(row);
158
- this.parent["" + updateRowAndCellElements](totalRecord, rows, index);
157
+ this.updateRowAndCellElements(totalRecord, rows, index);
158
+ }
159
+ }
160
+ };
161
+ /**
162
+ * Updates the rows and cells
163
+ *
164
+ * @param {Object[]} records - Updates the given records
165
+ * @param {HTMLTableRowElement[]} rows - Updates the given rows
166
+ * @param {number} index - Updates the given cell index
167
+ * @returns {void}
168
+ */
169
+ RowDD.prototype.updateRowAndCellElements = function (records, rows, index) {
170
+ for (var i = 0; i < records.length; i++) {
171
+ this.parent.renderModule.cellRender({
172
+ data: records[parseInt(i.toString(), 10)], cell: rows[parseInt(i.toString(), 10)].cells[parseInt(index.toString(), 10)],
173
+ column: this.parent.grid.getColumns()[this.parent.treeColumnIndex],
174
+ requestType: 'rowDragAndDrop'
175
+ });
176
+ if (this.parent['action'] === 'indenting' || this.parent['action'] === 'outdenting') {
177
+ this.parent.renderModule.RowModifier({
178
+ data: records[parseInt(i.toString(), 10)], row: rows[parseInt(i.toString(), 10)]
179
+ });
159
180
  }
160
181
  }
161
182
  };
@@ -204,7 +225,7 @@ var RowDD = /** @class */ (function () {
204
225
  record_1.parentItem.taskData) {
205
226
  dropIndex = i;
206
227
  if (tObj.enableVirtualization) {
207
- dropIndex = parseInt(tObj.getRows()[parseInt(i.toString(), 10)].getAttribute('data-rowindex'), 10);
228
+ dropIndex = parseInt(tObj.getRows()[parseInt(i.toString(), 10)].getAttribute('aria-rowindex'), 10) - 1;
208
229
  }
209
230
  }
210
231
  }
@@ -213,26 +234,27 @@ var RowDD = /** @class */ (function () {
213
234
  dropIndex = this.selectedRow.rowIndex - 1;
214
235
  }
215
236
  if (this.parent.enableVirtualization && this.selectedRecord && !(record_1.level > this.selectedRecord.level)) {
216
- dropIndex = parseInt(this.selectedRow.getAttribute('data-rowindex'), 10) - 1;
237
+ dropIndex = parseInt(this.selectedRow.getAttribute('aria-rowindex'), 10) - 2;
217
238
  }
218
239
  tObj["" + action] = 'indenting';
219
240
  tObj["" + droppedIndex] = dropIndex;
220
241
  this.eventTrigger('indenting', dropIndex);
221
242
  }
222
243
  else if (request === 'outdent') {
223
- if (this.selectedRow.rowIndex === -1 || this.selectedRow.rowIndex === 0 ||
224
- tObj.getCurrentViewRecords()[this.selectedRow.rowIndex].level === 0) {
244
+ var isInvalidSelection = this.selectedRow.rowIndex === -1 || this.selectedRow.rowIndex === 0;
245
+ var isRootLevel = tObj.getCurrentViewRecords()[this.selectedRow.rowIndex].level === 0;
246
+ if (isInvalidSelection || isRootLevel) {
225
247
  return;
226
248
  }
227
- var dropIndex = void 0;
228
- var parentItem = this.selectedRecord.parentItem;
229
- for (var i = 0; i < tObj.getCurrentViewRecords().length; i++) {
230
- if (tObj.getCurrentViewRecords()[parseInt(i.toString(), 10)].uniqueID === parentItem.uniqueID) {
231
- dropIndex = i;
232
- }
249
+ var parentItem_1 = this.selectedRecord.parentItem;
250
+ var records = tObj.getCurrentViewRecords();
251
+ var dropIndex = records.findIndex(function (record) { return record.uniqueID === parentItem_1.uniqueID; });
252
+ if (dropIndex === -1) {
253
+ return;
233
254
  }
234
255
  if (this.parent.enableVirtualization && this.selectedRecord) {
235
- dropIndex = parseInt(this.parent.getRows()[parseInt(dropIndex.toString(), 10)].getAttribute('data-rowindex'), 10);
256
+ var ariaRowIndex = this.parent.getRows()[parseInt(dropIndex.toString(), 10)].getAttribute('aria-rowindex');
257
+ dropIndex = parseInt(ariaRowIndex, 10) - 1;
236
258
  }
237
259
  tObj["" + action] = 'outdenting';
238
260
  tObj["" + droppedIndex] = dropIndex;
@@ -259,7 +281,7 @@ var RowDD = /** @class */ (function () {
259
281
  if (!actionArgs.cancel) {
260
282
  if (actionArgs.action === 'indenting') {
261
283
  if (_this.parent.enableVirtualization) {
262
- _this.reorderRows([parseInt(_this.selectedRow.getAttribute('data-rowindex'), 10)], dropIndex, 'child');
284
+ _this.reorderRows([parseInt(_this.selectedRow.getAttribute('aria-rowindex'), 10) - 1], dropIndex, 'child');
263
285
  }
264
286
  else {
265
287
  _this.reorderRows([_this.selectedRow.rowIndex], dropIndex, 'child');
@@ -267,7 +289,7 @@ var RowDD = /** @class */ (function () {
267
289
  }
268
290
  else if (actionArgs.action === 'outdenting') {
269
291
  if (_this.parent.enableVirtualization) {
270
- _this.reorderRows([parseInt(_this.selectedRow.getAttribute('data-rowindex'), 10)], dropIndex, 'below');
292
+ _this.reorderRows([parseInt(_this.selectedRow.getAttribute('aria-rowindex'), 10) - 1], dropIndex, 'below');
271
293
  }
272
294
  else {
273
295
  _this.reorderRows([_this.selectedRow.rowIndex], dropIndex, 'below');
@@ -570,7 +592,8 @@ var RowDD = /** @class */ (function () {
570
592
  else {
571
593
  rowTop = rowPositionHeight + contentHeight + roundOff;
572
594
  }
573
- var rowBottom = rowTop + row[0].offsetHeight;
595
+ var rowBottom = row[0].offsetHeight !== 0 && isNullOrUndefined(rowEle) ?
596
+ rowTop + row[0].offsetHeight : rowTop + rowEle.offsetHeight;
574
597
  var difference = rowBottom - rowTop;
575
598
  var divide = difference / 3;
576
599
  var topRowSegment = rowTop + divide;
@@ -587,6 +610,7 @@ var RowDD = /** @class */ (function () {
587
610
  var isTopSegment = posy <= topRowSegment;
588
611
  var isMiddleRowSegment = (posy > topRowSegment && posy <= middleRowSegment);
589
612
  var isBottomRowSegment = (posy > middleRowSegment && posy <= bottomRowSegment);
613
+ var isBorderNeed = true;
590
614
  if (isTopSegment || isMiddleRowSegment || isBottomRowSegment) {
591
615
  if (isTopSegment && this.dropPosition !== 'Invalid') {
592
616
  this.removeChildBorder();
@@ -595,19 +619,12 @@ var RowDD = /** @class */ (function () {
595
619
  this.addFirstrowBorder(rowEle);
596
620
  this.removeErrorElem();
597
621
  this.removeLastrowBorder(rowEle);
598
- this.topOrBottomBorder(args.target);
599
622
  }
600
623
  if (isMiddleRowSegment && this.dropPosition !== 'Invalid') {
601
624
  this.removetopOrBottomBorder();
602
- var rowElement = [];
603
- var element = closest(args.target, 'tr');
604
- rowElement = [].slice.call(element.querySelectorAll('.e-rowcell,.e-rowdragdrop,.e-detailrowcollapse'));
605
- if (rowElement.length > 0) {
606
- this.addRemoveClasses(rowElement, true, 'e-childborder');
607
- }
625
+ this.dropPosition = 'middleSegment';
608
626
  this.addLastRowborder(rowEle);
609
627
  this.addFirstrowBorder(rowEle);
610
- this.dropPosition = 'middleSegment';
611
628
  }
612
629
  if (isBottomRowSegment && this.dropPosition !== 'Invalid') {
613
630
  this.removeErrorElem();
@@ -616,11 +633,165 @@ var RowDD = /** @class */ (function () {
616
633
  this.dropPosition = 'bottomSegment';
617
634
  this.addLastRowborder(rowEle);
618
635
  this.removeFirstrowBorder(rowEle);
619
- this.topOrBottomBorder(args.target);
636
+ }
637
+ if ((isTopSegment || isBottomRowSegment) && this.dropPosition !== 'Invalid') {
638
+ isBorderNeed = this.updateBorderStatus(row, index);
639
+ this.topOrBottomBorder(args.target, isBorderNeed);
640
+ }
641
+ else if (isMiddleRowSegment && this.dropPosition !== 'Invalid') {
642
+ var rowElement = [];
643
+ var element = closest(args.target, 'tr');
644
+ rowElement = [].slice.call(element.querySelectorAll('.e-rowcell,.e-rowdragdrop,.e-detailrowcollapse'));
645
+ isBorderNeed = this.updateBorderStatus(row, index);
646
+ if (rowElement.length > 0 && isBorderNeed) {
647
+ this.addRemoveClasses(rowElement, true, 'e-childborder');
648
+ }
620
649
  }
621
650
  }
622
651
  return this.dropPosition;
623
652
  };
653
+ /**
654
+ * Updates the border status for a specified row and index.
655
+ *
656
+ * @private
657
+ * @param {Element[]} row - The array of row elements to be updated.
658
+ * @param {number} index - The index of the row element for which the border status is to be updated.
659
+ * @returns {boolean} - Returns true if the border status was successfully updated, otherwise false.
660
+ */
661
+ RowDD.prototype.updateBorderStatus = function (row, index) {
662
+ var _this = this;
663
+ var isBorderNeed = true;
664
+ var rows = this.parent.grid.getRows();
665
+ var childRows = [];
666
+ var hasDetailTemplate = false;
667
+ if (!isNullOrUndefined(this.parent.detailTemplate)) {
668
+ rows = this.parent.getDataRows();
669
+ hasDetailTemplate = true;
670
+ }
671
+ var treegridColumnIndex = this.parent.treeColumnIndex;
672
+ var treeColIndex = this.parent.allowRowDragAndDrop ?
673
+ (hasDetailTemplate ? treegridColumnIndex + 2 : treegridColumnIndex + 1) :
674
+ (hasDetailTemplate ? treegridColumnIndex + 1 : treegridColumnIndex);
675
+ if (!isNullOrUndefined(this.parent.rowDropSettings.targetID)) {
676
+ treeColIndex = treegridColumnIndex;
677
+ }
678
+ var dragRows = row;
679
+ var targetRow = [rows["" + index]];
680
+ if (this.dropPosition === 'topSegment') {
681
+ row.filter(function (e) {
682
+ if (isNullOrUndefined(e) || isNullOrUndefined(e.cells) || isNullOrUndefined(targetRow[0]) ||
683
+ isNullOrUndefined(targetRow[0].cells)) {
684
+ return true;
685
+ }
686
+ var regex = /index(\d+)|level(\d+)/g;
687
+ var parentIndexLevel = e === null || e === undefined ? undefined : e.cells["" + treeColIndex].className.match(regex);
688
+ var dropIndexLevel = targetRow[0].cells["" + treeColIndex].className.match(regex);
689
+ if (isNullOrUndefined(dropIndexLevel) || isNullOrUndefined(dropIndexLevel)) {
690
+ return true;
691
+ }
692
+ var parentLevel = +parentIndexLevel[1].match(/\d+/)[0];
693
+ var dropParentLevel = +dropIndexLevel[1].match(/\d+/)[0];
694
+ var InDraggedRowIndex = false;
695
+ if (parentLevel !== 0 && parentLevel !== dropParentLevel) {
696
+ return true;
697
+ }
698
+ for (var i = 0; i < rows.length; i++) {
699
+ if (rows[parseInt(i.toString(), 10)] === dragRows[0]) {
700
+ InDraggedRowIndex = true;
701
+ }
702
+ if (InDraggedRowIndex && rows[parseInt(i.toString(), 10)] !== dragRows[0]) {
703
+ var parentIndexLevelInRow = rows[parseInt(i.toString(), 10)].cells["" + treeColIndex].className.match(regex);
704
+ var parentLevelInRow = +parentIndexLevelInRow[1].match(/\d+/)[0];
705
+ if (parentLevelInRow !== parentLevel && parentLevelInRow > parentLevel) {
706
+ childRows.push(rows[parseInt(i.toString(), 10)]);
707
+ }
708
+ else {
709
+ break;
710
+ }
711
+ }
712
+ }
713
+ if (parentLevel === dropParentLevel && ((childRows.length > 0 && parseInt(row[0].getAttribute('aria-rowindex'), 10) - 1 === index - (childRows.length + 1)) || (childRows.length === 0 && parseInt(row[0].getAttribute('aria-rowindex'), 10) - 1 === index - 1))) {
714
+ isBorderNeed = false;
715
+ }
716
+ return true;
717
+ });
718
+ isBorderNeed = (!isNullOrUndefined(row) && childRows.length === 0 && !isNullOrUndefined(row[0].getAttribute('aria-rowindex')) && parseInt(row[0].getAttribute('aria-rowindex'), 10) - 1 === index - 1) && isNullOrUndefined(row[0]) ? false : isBorderNeed;
719
+ }
720
+ if (this.dropPosition === 'bottomSegment') {
721
+ targetRow.filter(function (e) {
722
+ if (isNullOrUndefined(e) || isNullOrUndefined(e.cells) || isNullOrUndefined(dragRows[0]) ||
723
+ isNullOrUndefined(dragRows[0].cells)) {
724
+ return true;
725
+ }
726
+ var regex = /index(\d+)|level(\d+)/g;
727
+ var parentIndexLevel = e === null || e === undefined ? undefined : e.cells["" + treeColIndex].className.match(regex);
728
+ var dragIndexLevel = dragRows[0].cells["" + treeColIndex].className.match(regex);
729
+ if (isNullOrUndefined(dragIndexLevel) || isNullOrUndefined(parentIndexLevel)) {
730
+ return true;
731
+ }
732
+ var parentLevel = +parentIndexLevel[1].match(/\d+/)[0];
733
+ var dragParentLevel = +dragIndexLevel[1].match(/\d+/)[0];
734
+ var InDraggedRowIndex = false;
735
+ if (parentLevel !== 0 && parentLevel !== dragParentLevel) {
736
+ return true;
737
+ }
738
+ for (var i = 0; i < rows.length; i++) {
739
+ if (rows[parseInt(i.toString(), 10)] === targetRow[0]) {
740
+ InDraggedRowIndex = true;
741
+ }
742
+ if (InDraggedRowIndex && rows[parseInt(i.toString(), 10)] !== targetRow[0]) {
743
+ var parentIndexLevelInRow = rows[parseInt(i.toString(), 10)].cells["" + treeColIndex].className.match(regex);
744
+ var parentLevelInRow = +parentIndexLevelInRow[1].match(/\d+/)[0];
745
+ if (parentLevelInRow !== parentLevel && parentLevelInRow > parentLevel) {
746
+ childRows.push(rows[parseInt(i.toString(), 10)]);
747
+ }
748
+ else {
749
+ break;
750
+ }
751
+ }
752
+ }
753
+ if (!isNullOrUndefined(row) && parentLevel === dragParentLevel && ((childRows.length > 0 && !isNullOrUndefined(row[0].getAttribute('aria-rowindex')) && parseInt(row[0].getAttribute('aria-rowindex'), 10) - 1 === index + (childRows.length + 1)) || (childRows.length === 0 && !isNullOrUndefined(row[0].getAttribute('aria-rowindex')) && parseInt(row[0].getAttribute('aria-rowindex'), 10) - 1 === index + 1))) {
754
+ isBorderNeed = false;
755
+ }
756
+ return true;
757
+ });
758
+ isBorderNeed = (!isNullOrUndefined(row) && childRows.length === 0 && !isNullOrUndefined(row[0].getAttribute('aria-rowindex')) && parseInt(row[0].getAttribute('aria-rowindex'), 10) - 1 === index + 1) && isNullOrUndefined(row[0]) ? false : isBorderNeed;
759
+ }
760
+ if (this.dropPosition === 'middleSegment') {
761
+ targetRow.filter(function (e) {
762
+ if (isNullOrUndefined(e) || isNullOrUndefined(e.cells) || isNullOrUndefined(dragRows[0]) ||
763
+ isNullOrUndefined(dragRows[0].cells)) {
764
+ return true;
765
+ }
766
+ for (var i = 0; i < dragRows.length; i++) {
767
+ var regex = /index(\d+)|level(\d+)/g;
768
+ var dropActualIndex = targetRow[0].rowIndex;
769
+ var dragIndexLevel = dragRows[parseInt(i.toString(), 10)].cells["" + treeColIndex].className.match(regex);
770
+ if (!dragIndexLevel) {
771
+ return true;
772
+ }
773
+ var dragIndex = parseInt(dragIndexLevel.find(function (item) { return item.includes('index'); }).match(/\d+/)[0] || '0', 10);
774
+ if (hasDetailTemplate) {
775
+ dropActualIndex = dropActualIndex / 2;
776
+ }
777
+ if (dragIndex === dropActualIndex && !_this.parent.rowDropSettings.targetID) {
778
+ isBorderNeed = false;
779
+ }
780
+ else {
781
+ isBorderNeed = true;
782
+ break;
783
+ }
784
+ }
785
+ if (!isBorderNeed) {
786
+ _this.dropPosition = 'Invalid';
787
+ _this.addErrorElem();
788
+ }
789
+ return isBorderNeed;
790
+ });
791
+ }
792
+ this.canDrop = isBorderNeed;
793
+ return isBorderNeed;
794
+ };
624
795
  /**
625
796
  * Removes the visual border from all child rows within the TreeGrid.
626
797
  *
@@ -761,23 +932,28 @@ var RowDD = /** @class */ (function () {
761
932
  * Applies drop border styles to row elements based on the current drop position ('topSegment' or 'bottomSegment').
762
933
  *
763
934
  * @param {Element} target - The target element where the drop action is taking place.
935
+ * @param {boolean} [isBorderNeed=true] - Indicates whether a border is needed during the drop action. Defaults to `true`.
764
936
  * @returns {void} No return value.
765
937
  */
766
- RowDD.prototype.topOrBottomBorder = function (target) {
767
- var rowElement = [];
938
+ RowDD.prototype.topOrBottomBorder = function (target, isBorderNeed) {
939
+ if (isBorderNeed === void 0) { isBorderNeed = true; }
768
940
  var element = closest(target, 'tr');
769
- rowElement = element ? [].slice.call(element.querySelectorAll('.e-rowcell,.e-rowdragdrop,.e-detailrowcollapse')) : [];
770
- if (rowElement.length) {
771
- if (this.dropPosition === 'topSegment') {
772
- this.addRemoveClasses(rowElement, true, 'e-droptop');
773
- if (this.parent.element.getElementsByClassName('e-lastrow-dragborder').length > 0) {
774
- this.parent.element.getElementsByClassName('e-lastrow-dragborder')[0].remove();
775
- }
776
- }
777
- if (this.dropPosition === 'bottomSegment') {
778
- this.addRemoveClasses(rowElement, true, 'e-dropbottom');
941
+ var rowElements = element ?
942
+ Array.from(element.querySelectorAll('.e-rowcell, .e-rowdragdrop, .e-detailrowcollapse')) : [];
943
+ if (!rowElements.length) {
944
+ return;
945
+ }
946
+ var classAction = isBorderNeed ? this.addRemoveClasses.bind(this, rowElements, true) : this.addRemoveClasses.bind(this, rowElements, false, 'e-dragborder');
947
+ if (this.dropPosition === 'topSegment') {
948
+ classAction('e-droptop');
949
+ var lastRowDragBorder = this.parent.element.querySelector('.e-lastrow-dragborder');
950
+ if (lastRowDragBorder) {
951
+ lastRowDragBorder.remove();
779
952
  }
780
953
  }
954
+ if (this.dropPosition === 'bottomSegment') {
955
+ classAction('e-dropbottom');
956
+ }
781
957
  };
782
958
  /**
783
959
  * Removes the drop border classes ('e-dropbottom' and 'e-droptop') from the parent element if present.
@@ -842,18 +1018,29 @@ var RowDD = /** @class */ (function () {
842
1018
  }
843
1019
  cloneElement.style.cursor = '';
844
1020
  var rowEle = args.target ? closest(args.target, 'tr') : null;
845
- var rowIdx = rowEle ? rowEle.rowIndex : -1;
1021
+ var rowIdx = -1;
1022
+ if (!isNullOrUndefined(this.parent.detailTemplate)) {
1023
+ rowIdx = rowEle ? this.parent.getDataRows().indexOf(rowEle) : -1;
1024
+ }
1025
+ else {
1026
+ rowIdx = rowEle ? rowEle.rowIndex : -1;
1027
+ }
846
1028
  if (rowIdx === -1) {
847
1029
  this.canDrop = false;
848
1030
  this.addErrorElem();
849
- if (isNullOrUndefined(tObj.rowDropSettings.targetID)) {
850
- this.removetopOrBottomBorder();
851
- this.removeChildBorder();
852
- }
1031
+ this.removetopOrBottomBorder();
1032
+ this.removeChildBorder();
853
1033
  return;
854
1034
  }
855
1035
  var dragRecords = Array.isArray(args.data) ? args.data : [args.data];
856
1036
  var droppedRecord = tObj.getCurrentViewRecords()[parseInt(rowIdx.toString(), 10)];
1037
+ if (tObj.rowDropSettings.targetID) {
1038
+ var dropElement = parentsUntil(args.target, 'e-treegrid');
1039
+ if (dropElement && dropElement.id === this.parent.rowDropSettings.targetID) {
1040
+ var srcControl = dropElement.ej2_instances[0];
1041
+ droppedRecord = srcControl.getCurrentViewRecords()[parseInt(rowIdx.toString(), 10)];
1042
+ }
1043
+ }
857
1044
  this.removeErrorElem();
858
1045
  this.canDrop = true;
859
1046
  this.ensuredropPosition(dragRecords, droppedRecord);
@@ -885,13 +1072,13 @@ var RowDD = /** @class */ (function () {
885
1072
  var parentItem = 'parentItem';
886
1073
  if (!tObj.rowDropSettings.targetID) {
887
1074
  if (parentsUntil(args.target, 'e-content') || (this.dropPosition === 'Invalid' || !this.canDrop)) {
888
- if (this.parent.element.querySelector('.e-errorelem')) {
1075
+ if (this.parent.element.querySelector('.e-errorelem') || !this.canDrop) {
889
1076
  this.dropPosition = 'Invalid';
890
1077
  }
891
1078
  setValue('dropPosition', this.dropPosition, args);
892
1079
  tObj.trigger(events.rowDrop, args);
893
1080
  if (!args.cancel) {
894
- if (!isCountRequired(this.parent) && this.dropPosition === 'Invalid') {
1081
+ if (!isCountRequired(this.parent) && (this.dropPosition === 'Invalid' && !this.canDrop)) {
895
1082
  return;
896
1083
  }
897
1084
  if (!isCountRequired(this.parent)) {
@@ -908,9 +1095,15 @@ var RowDD = /** @class */ (function () {
908
1095
  else {
909
1096
  if (args.target && closest(args.target, '#' + tObj.rowDropSettings.targetID) || parentsUntil(args.target, 'e-treegrid') &&
910
1097
  parentsUntil(args.target, 'e-treegrid').id === tObj.rowDropSettings.targetID || args.target && document.getElementById(tObj.rowDropSettings.targetID)) {
1098
+ if (this.parent.element.querySelector('.e-errorelem') || !this.canDrop) {
1099
+ this.dropPosition = 'Invalid';
1100
+ }
911
1101
  setValue('dropPosition', this.dropPosition, args);
912
1102
  tObj.trigger(events.rowDrop, args);
913
1103
  if (!args.cancel && tObj.rowDropSettings.targetID) {
1104
+ if (this.dropPosition === 'Invalid' && !this.canDrop) {
1105
+ return;
1106
+ }
914
1107
  this.dragDropGrid(args);
915
1108
  if (tObj.isLocalData) {
916
1109
  tObj.flatData = this.orderToIndex(tObj.flatData);
@@ -1043,13 +1236,13 @@ var RowDD = /** @class */ (function () {
1043
1236
  }
1044
1237
  };
1045
1238
  /**
1046
- * Retrieves the index of the target row based on its 'data-rowindex' attribute.
1239
+ * Retrieves the index of the target row based on its 'aria-rowindex' attribute.
1047
1240
  *
1048
1241
  * @param {Element} targetRow - The target row element from which to retrieve the index.
1049
1242
  * @returns {number} - The index of the target row, or 0 if the targetRow is null or undefined.
1050
1243
  */
1051
1244
  RowDD.prototype.getTargetIdx = function (targetRow) {
1052
- return targetRow ? parseInt(targetRow.getAttribute('data-rowindex'), 10) : 0;
1245
+ return targetRow ? parseInt(targetRow.getAttribute('aria-rowindex'), 10) - 1 : 0;
1053
1246
  };
1054
1247
  /**
1055
1248
  * Retrieves the parent data of a given record during a row drag-and-drop operation.
@@ -1112,7 +1305,13 @@ var RowDD = /** @class */ (function () {
1112
1305
  this.droppedRecord = tObj.getCurrentViewRecords()[parseInt(index.toString(), 10)];
1113
1306
  }
1114
1307
  else {
1115
- this.droppedRecord = tObj.getCurrentViewRecords()[args.dropIndex];
1308
+ if (!isNullOrUndefined(this.parent.rowDropSettings.targetID)) {
1309
+ var rowsObject = this.parent.grid.getRowsObject();
1310
+ this.droppedRecord = rowsObject.length > 0 ? rowsObject[args.dropIndex].data : undefined;
1311
+ }
1312
+ else {
1313
+ this.droppedRecord = tObj.getCurrentViewRecords()[args.dropIndex];
1314
+ }
1116
1315
  }
1117
1316
  }
1118
1317
  var dragRecords = [];
@@ -1650,6 +1849,7 @@ var RowDD = /** @class */ (function () {
1650
1849
  };
1651
1850
  /**
1652
1851
  * Cleans up resources, event listeners, and DOM elements when the TreeGrid component is destroyed.
1852
+ *
1653
1853
  * @returns {void}
1654
1854
  */
1655
1855
  RowDD.prototype.destroy = function () {
@@ -201,7 +201,7 @@ var Aggregate = /** @class */ (function () {
201
201
  var cellElement = createElement('td', {
202
202
  className: 'e-summary'
203
203
  });
204
- if (this.parent.isReact) {
204
+ if (this.parent.isReact && typeof (summaryColumn.footerTemplate) !== 'string') {
205
205
  var renderReactTemplates = 'renderReactTemplates';
206
206
  tempObj.fn(single[summaryColumn.columnName], this.parent, tempObj.property, '', null, null, cellElement);
207
207
  this.parent["" + renderReactTemplates]();
@@ -21,7 +21,6 @@ export declare class VirtualScroll {
21
21
  * @param {TreeGrid} parent - Tree Grid instance
22
22
  */
23
23
  constructor(parent?: TreeGrid);
24
- private returnVisualData;
25
24
  /**
26
25
  * For internal use only - Get the module name.
27
26
  *
@@ -39,7 +38,33 @@ export declare class VirtualScroll {
39
38
  * @returns {void}
40
39
  */
41
40
  removeEventListener(): void;
41
+ /**
42
+ * Handles the virtual child collapse or expand action in a tree grid.
43
+ *
44
+ * @param {object} row - Object containing information about the collapse/expand action.
45
+ * @param {string} row.action - The type of action, either "collapse" or "expand".
46
+ * @param {HTMLTableRowElement} row.row - The HTML row element that is affected by the action.
47
+ * @param {ITreeData} row.record - The tree data record associated with the row.
48
+ * @param {RowCollapsedEventArgs} row.args - Additional event arguments related to the row collapse or expand.
49
+ *
50
+ * @returns {void} No return value as the function executes a procedure.
51
+ */
42
52
  private collapseExpandVirtualchilds;
53
+ /**
54
+ * Handles selection logic for the TreeGrid component.
55
+ *
56
+ * @returns {void}
57
+ */
58
+ private handleSelection;
59
+ /**
60
+ * Handles the action related to virtual scrolling with paging details.
61
+ *
62
+ * @param {Object} pageingDetails - Contains the result data, count of results, and action arguments.
63
+ * @param {ITreeData[]} pageingDetails.result - The result data to be handled.
64
+ * @param {number} pageingDetails.count - The count of results.
65
+ * @param {ActionEventArgs} pageingDetails.actionArgs - The action arguments related to the virtual page action.
66
+ * @returns {void}
67
+ */
43
68
  private virtualPageAction;
44
69
  /**
45
70
  * To destroy the virtualScroll module
@@ -48,6 +73,14 @@ export declare class VirtualScroll {
48
73
  * @hidden
49
74
  */
50
75
  destroy(): void;
76
+ /**
77
+ * Updates the row selection when the header checkbox is clicked and the number of selected rows
78
+ * does not match the current view data length.
79
+ *
80
+ * @param {RowDeselectEventArgs} args - The arguments containing details of the row deselection event.
81
+ * @returns {void} - This method does not return a value.
82
+ */
83
+ private updateSelection;
51
84
  }
52
85
  export declare class TreeVirtual extends GridVirtualScroll {
53
86
  constructor(parent: IGrid, locator?: ServiceLocator);
@@ -39,9 +39,6 @@ var VirtualScroll = /** @class */ (function () {
39
39
  Grid.Inject(TreeVirtual);
40
40
  this.addEventListener();
41
41
  }
42
- VirtualScroll.prototype.returnVisualData = function (args) {
43
- args.data = this.visualData;
44
- };
45
42
  /**
46
43
  * For internal use only - Get the module name.
47
44
  *
@@ -75,28 +72,58 @@ var VirtualScroll = /** @class */ (function () {
75
72
  this.parent.off(events.pagingActions, this.virtualPageAction);
76
73
  this.parent.off(events.destroy, this.destroy);
77
74
  };
75
+ /**
76
+ * Handles the virtual child collapse or expand action in a tree grid.
77
+ *
78
+ * @param {object} row - Object containing information about the collapse/expand action.
79
+ * @param {string} row.action - The type of action, either "collapse" or "expand".
80
+ * @param {HTMLTableRowElement} row.row - The HTML row element that is affected by the action.
81
+ * @param {ITreeData} row.record - The tree data record associated with the row.
82
+ * @param {RowCollapsedEventArgs} row.args - Additional event arguments related to the row collapse or expand.
83
+ *
84
+ * @returns {void} No return value as the function executes a procedure.
85
+ */
78
86
  VirtualScroll.prototype.collapseExpandVirtualchilds = function (row) {
79
87
  this.parent.grid.notify(events.virtualActionArgs, { isExpandCollapse: true });
80
88
  this.expandCollapseRec = row.record;
81
89
  row.record.expanded = row.action === 'collapse' ? false : true;
82
- var ret = {
90
+ this.parent.flatData.map(function (e) { return e.expanded = e.uniqueID === row.record.uniqueID &&
91
+ e.expanded !== row.record.expanded ? row.record.expanded : e.expanded; });
92
+ var actionDetails = {
83
93
  result: this.parent.flatData,
84
94
  row: row.row,
85
95
  action: row.action,
86
96
  record: row.record,
87
97
  count: this.parent.flatData.length
88
98
  };
89
- if (this.parent.enableVirtualization && this.parent.selectionSettings.mode === 'Cell' ||
90
- this.parent.selectionSettings.mode === 'Row' && !this.parent.selectionSettings.persistSelection) {
99
+ this.handleSelection();
100
+ var requestType = getValue('isCollapseAll', this.parent) ? 'collapseAll' : 'refresh';
101
+ getValue('grid.renderModule', this.parent).dataManagerSuccess(actionDetails, { requestType: requestType });
102
+ };
103
+ /**
104
+ * Handles selection logic for the TreeGrid component.
105
+ *
106
+ * @returns {void}
107
+ */
108
+ VirtualScroll.prototype.handleSelection = function () {
109
+ if ((this.parent.selectionSettings.mode === 'Cell' ||
110
+ (this.parent.selectionSettings.mode === 'Row' && !this.parent.selectionSettings.persistSelection))) {
91
111
  this.parent.grid.clearSelection();
92
112
  }
93
113
  if (getValue('isCollapseAll', this.parent) && this.parent.selectionSettings.persistSelection && this.parent.getSelectedRecords().length > 0) {
94
114
  this.prevSelectedRecord = this.parent.getSelectedRecords();
95
115
  this.parent.grid.clearSelection();
96
116
  }
97
- var requestType = getValue('isCollapseAll', this.parent) ? 'collapseAll' : 'refresh';
98
- getValue('grid.renderModule', this.parent).dataManagerSuccess(ret, { requestType: requestType });
99
117
  };
118
+ /**
119
+ * Handles the action related to virtual scrolling with paging details.
120
+ *
121
+ * @param {Object} pageingDetails - Contains the result data, count of results, and action arguments.
122
+ * @param {ITreeData[]} pageingDetails.result - The result data to be handled.
123
+ * @param {number} pageingDetails.count - The count of results.
124
+ * @param {ActionEventArgs} pageingDetails.actionArgs - The action arguments related to the virtual page action.
125
+ * @returns {void}
126
+ */
100
127
  VirtualScroll.prototype.virtualPageAction = function (pageingDetails) {
101
128
  var _this = this;
102
129
  var dm = new DataManager(pageingDetails.result);
@@ -127,7 +154,7 @@ var VirtualScroll = /** @class */ (function () {
127
154
  if (requestType === 'filtering' || requestType === 'collapseAll' || requestType === 'searching' || (requestType === 'refresh' && getValue('isExpandAll', this.parent)) ||
128
155
  (requestType === 'refresh' && this.parent.enableCollapseAll && endIndex > visualData.length && isNullOrUndefined(this.expandCollapseRec))) {
129
156
  startIndex = 0;
130
- endIndex = this.parent.grid.pageSettings.pageSize - 1;
157
+ endIndex = this.parent.grid.pageSettings.pageSize;
131
158
  this.parent.grid.getContent().firstElementChild.scrollTop = 0;
132
159
  this.parent.grid.notify(events.virtualActionArgs, { setTop: true });
133
160
  }
@@ -170,7 +197,7 @@ var VirtualScroll = /** @class */ (function () {
170
197
  var newRowsCount = sIndex - startIndex;
171
198
  startIndex = sIndex;
172
199
  if (visualData.indexOf(this.expandCollapseRec) > visualData.length - resourceCount / 2) {
173
- var newTranslateY = translateY + (newRowsCount * this.parent.grid.getRowHeight());
200
+ var newTranslateY = startIndex * this.parent.grid.getRowHeight();
174
201
  this.parent.grid.contentModule['translateY'] = newTranslateY;
175
202
  this.parent.grid.contentModule.virtualEle.adjustTable(0, newTranslateY);
176
203
  }
@@ -193,7 +220,7 @@ var VirtualScroll = /** @class */ (function () {
193
220
  if (pageingDetails.count < this.parent.getRows()[0].getBoundingClientRect().height) {
194
221
  startIndex = 0;
195
222
  }
196
- else if (!this.parent['isExpandAll']) {
223
+ else if (!this.parent['isExpandAll'] && this.parent.grid.contentModule['translateY'] === 0) {
197
224
  startIndex = this.prevstartIndex === -1 ? 0 : this.prevstartIndex;
198
225
  }
199
226
  }
@@ -220,6 +247,26 @@ var VirtualScroll = /** @class */ (function () {
220
247
  VirtualScroll.prototype.destroy = function () {
221
248
  this.removeEventListener();
222
249
  };
250
+ /**
251
+ * Updates the row selection when the header checkbox is clicked and the number of selected rows
252
+ * does not match the current view data length.
253
+ *
254
+ * @param {RowDeselectEventArgs} args - The arguments containing details of the row deselection event.
255
+ * @returns {void} - This method does not return a value.
256
+ */
257
+ VirtualScroll.prototype.updateSelection = function (args) {
258
+ if (args.isHeaderCheckboxClicked &&
259
+ this.parent.grid.currentViewData.length !== this.parent.grid.selectionModule.selectedRowIndexes.length) {
260
+ var updateRowSelection = 'updateRowSelection';
261
+ for (var i = 0; i < this.parent.getRows().length; i++) {
262
+ if (this.parent.getRows()[parseInt(i.toString(), 10)].getElementsByClassName('e-frame e-icons e-uncheck').length) {
263
+ this.parent.grid.selectionModule["" + updateRowSelection](this.parent.getRows()[parseInt(i.toString(), 10)],
264
+ // eslint-disable-next-line max-len
265
+ this.parent.getCurrentViewRecords()[parseInt(i.toString(), 10)].index);
266
+ }
267
+ }
268
+ }
269
+ };
223
270
  return VirtualScroll;
224
271
  }());
225
272
  export { VirtualScroll };