@syncfusion/ej2-treegrid 28.2.6 → 29.1.37
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.
- package/README.md +2 -2
- package/dist/ej2-treegrid.min.js +2 -2
- package/dist/ej2-treegrid.umd.min.js +2 -2
- package/dist/ej2-treegrid.umd.min.js.map +1 -1
- package/dist/es6/ej2-treegrid.es2015.js +1281 -519
- package/dist/es6/ej2-treegrid.es2015.js.map +1 -1
- package/dist/es6/ej2-treegrid.es5.js +1283 -519
- package/dist/es6/ej2-treegrid.es5.js.map +1 -1
- package/dist/global/ej2-treegrid.min.js +2 -2
- package/dist/global/ej2-treegrid.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +10 -10
- package/src/treegrid/actions/batch-edit.js +12 -5
- package/src/treegrid/actions/edit.js +12 -12
- package/src/treegrid/actions/page.js +1 -1
- package/src/treegrid/actions/rowdragdrop.d.ts +21 -1
- package/src/treegrid/actions/rowdragdrop.js +252 -48
- package/src/treegrid/actions/summary.js +1 -1
- package/src/treegrid/actions/virtual-scroll.d.ts +34 -1
- package/src/treegrid/actions/virtual-scroll.js +58 -11
- package/src/treegrid/base/constant.d.ts +0 -4
- package/src/treegrid/base/constant.js +0 -4
- package/src/treegrid/base/data.js +47 -46
- package/src/treegrid/base/treegrid-model.d.ts +195 -208
- package/src/treegrid/base/treegrid.d.ts +598 -411
- package/src/treegrid/base/treegrid.js +526 -307
- package/src/treegrid/enum.d.ts +77 -80
- package/src/treegrid/enum.js +2 -2
- package/src/treegrid/models/column.d.ts +122 -177
- package/src/treegrid/models/column.js +14 -26
- package/src/treegrid/models/edit-settings-model.d.ts +24 -25
- package/src/treegrid/models/edit-settings.d.ts +25 -26
- package/src/treegrid/models/edit-settings.js +1 -1
- package/src/treegrid/models/filter-settings-model.d.ts +41 -49
- package/src/treegrid/models/filter-settings.d.ts +43 -51
- package/src/treegrid/models/filter-settings.js +2 -2
- package/src/treegrid/models/infinite-scroll-settings-model.d.ts +4 -4
- package/src/treegrid/models/infinite-scroll-settings.d.ts +4 -4
- package/src/treegrid/models/infinite-scroll-settings.js +1 -1
- package/src/treegrid/models/loading-indicator-model.d.ts +3 -4
- package/src/treegrid/models/loading-indicator.d.ts +4 -4
- package/src/treegrid/models/loading-indicator.js +1 -1
- package/src/treegrid/models/page-settings-model.d.ts +10 -13
- package/src/treegrid/models/page-settings.d.ts +11 -14
- package/src/treegrid/models/page-settings.js +1 -1
- package/src/treegrid/models/rowdrop-settings-model.d.ts +1 -1
- package/src/treegrid/models/rowdrop-settings.d.ts +13 -6
- package/src/treegrid/models/rowdrop-settings.js +1 -1
- package/src/treegrid/models/search-settings-model.d.ts +13 -11
- package/src/treegrid/models/search-settings.d.ts +14 -12
- package/src/treegrid/models/search-settings.js +1 -1
- package/src/treegrid/models/selection-settings-model.d.ts +18 -29
- package/src/treegrid/models/selection-settings.d.ts +18 -29
- package/src/treegrid/models/sort-settings-model.d.ts +8 -5
- package/src/treegrid/models/sort-settings.d.ts +10 -7
- package/src/treegrid/models/sort-settings.js +2 -2
- package/src/treegrid/models/summary-model.d.ts +28 -29
- package/src/treegrid/models/summary.d.ts +32 -30
- package/src/treegrid/models/summary.js +4 -1
- package/src/treegrid/models/textwrap-settings-model.d.ts +7 -4
- package/src/treegrid/models/textwrap-settings.d.ts +8 -5
- package/src/treegrid/models/textwrap-settings.js +1 -1
- package/src/treegrid/renderer/render.js +11 -5
- package/src/treegrid/renderer/virtual-row-model-generator.js +5 -4
- package/src/treegrid/renderer/virtual-tree-content-render.d.ts +277 -0
- package/src/treegrid/renderer/virtual-tree-content-render.js +328 -35
- package/src/treegrid/utils.d.ts +1 -1
- package/styles/bootstrap-lite.css +0 -12
- package/styles/bootstrap.css +0 -12
- package/styles/bootstrap5-dark-lite.css +1 -1
- package/styles/bootstrap5-dark.css +1 -1
- package/styles/treegrid/_layout.scss +0 -1
- package/styles/treegrid/_material-dark-definition.scss +2 -2
- package/styles/treegrid/_material-definition.scss +2 -2
- package/styles/treegrid/bootstrap.css +0 -12
- package/styles/treegrid/bootstrap5-dark.css +1 -1
- package/styles/treegrid/icons/_bootstrap.scss +0 -17
- package/styles/treegrid/icons/_bootstrap5.scss +1 -1
- package/styles/treegrid/icons/_fabric-dark.scss +1 -1
- package/styles/treegrid/icons/_fabric.scss +1 -1
- package/styles/treegrid/icons/_fluent2.scss +1 -1
- package/styles/treegrid/icons/_fusionnew.scss +1 -0
- package/styles/treegrid/icons/_highcontrast-light.scss +1 -1
- 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.
|
|
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.
|
|
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('
|
|
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('
|
|
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
|
-
|
|
224
|
-
|
|
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
|
|
228
|
-
var
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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
|
-
|
|
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('
|
|
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('
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
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) || isNullOrUndefined(parentIndexLevel)) {
|
|
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
|
-
|
|
938
|
+
RowDD.prototype.topOrBottomBorder = function (target, isBorderNeed) {
|
|
939
|
+
if (isBorderNeed === void 0) { isBorderNeed = true; }
|
|
768
940
|
var element = closest(target, 'tr');
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
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.
|
|
@@ -787,6 +963,9 @@ var RowDD = /** @class */ (function () {
|
|
|
787
963
|
RowDD.prototype.removetopOrBottomBorder = function () {
|
|
788
964
|
var border = [];
|
|
789
965
|
border = [].slice.call(this.parent.element.querySelectorAll('.e-dropbottom, .e-droptop'));
|
|
966
|
+
if (this.parent.rowDropSettings.targetID) {
|
|
967
|
+
border = [].slice.call(document.querySelectorAll('.e-dropbottom, .e-droptop'));
|
|
968
|
+
}
|
|
790
969
|
if (border.length) {
|
|
791
970
|
this.addRemoveClasses(border, false, 'e-dropbottom');
|
|
792
971
|
this.addRemoveClasses(border, false, 'e-droptop');
|
|
@@ -842,18 +1021,29 @@ var RowDD = /** @class */ (function () {
|
|
|
842
1021
|
}
|
|
843
1022
|
cloneElement.style.cursor = '';
|
|
844
1023
|
var rowEle = args.target ? closest(args.target, 'tr') : null;
|
|
845
|
-
var rowIdx =
|
|
1024
|
+
var rowIdx = -1;
|
|
1025
|
+
if (!isNullOrUndefined(this.parent.detailTemplate)) {
|
|
1026
|
+
rowIdx = rowEle ? this.parent.getDataRows().indexOf(rowEle) : -1;
|
|
1027
|
+
}
|
|
1028
|
+
else {
|
|
1029
|
+
rowIdx = rowEle ? rowEle.rowIndex : -1;
|
|
1030
|
+
}
|
|
846
1031
|
if (rowIdx === -1) {
|
|
847
1032
|
this.canDrop = false;
|
|
848
1033
|
this.addErrorElem();
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
this.removeChildBorder();
|
|
852
|
-
}
|
|
1034
|
+
this.removetopOrBottomBorder();
|
|
1035
|
+
this.removeChildBorder();
|
|
853
1036
|
return;
|
|
854
1037
|
}
|
|
855
1038
|
var dragRecords = Array.isArray(args.data) ? args.data : [args.data];
|
|
856
1039
|
var droppedRecord = tObj.getCurrentViewRecords()[parseInt(rowIdx.toString(), 10)];
|
|
1040
|
+
if (tObj.rowDropSettings.targetID) {
|
|
1041
|
+
var dropElement = parentsUntil(args.target, 'e-treegrid');
|
|
1042
|
+
if (dropElement && dropElement.id === this.parent.rowDropSettings.targetID) {
|
|
1043
|
+
var srcControl = dropElement.ej2_instances[0];
|
|
1044
|
+
droppedRecord = srcControl.getCurrentViewRecords()[parseInt(rowIdx.toString(), 10)];
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
857
1047
|
this.removeErrorElem();
|
|
858
1048
|
this.canDrop = true;
|
|
859
1049
|
this.ensuredropPosition(dragRecords, droppedRecord);
|
|
@@ -865,6 +1055,7 @@ var RowDD = /** @class */ (function () {
|
|
|
865
1055
|
if (dropElement && dropElement.id === this.parent.rowDropSettings.targetID) {
|
|
866
1056
|
var srcControl = dropElement.ej2_instances[0];
|
|
867
1057
|
srcControl.rowDragAndDropModule.updateIcon(args.rows, rowIdx, args);
|
|
1058
|
+
this.dropPosition = srcControl.rowDragAndDropModule.dropPosition;
|
|
868
1059
|
}
|
|
869
1060
|
}
|
|
870
1061
|
if (args.target && closest(args.target, '#' + tObj.rowDropSettings.targetID)) {
|
|
@@ -885,13 +1076,13 @@ var RowDD = /** @class */ (function () {
|
|
|
885
1076
|
var parentItem = 'parentItem';
|
|
886
1077
|
if (!tObj.rowDropSettings.targetID) {
|
|
887
1078
|
if (parentsUntil(args.target, 'e-content') || (this.dropPosition === 'Invalid' || !this.canDrop)) {
|
|
888
|
-
if (this.parent.element.querySelector('.e-errorelem')) {
|
|
1079
|
+
if (this.parent.element.querySelector('.e-errorelem') || !this.canDrop) {
|
|
889
1080
|
this.dropPosition = 'Invalid';
|
|
890
1081
|
}
|
|
891
1082
|
setValue('dropPosition', this.dropPosition, args);
|
|
892
1083
|
tObj.trigger(events.rowDrop, args);
|
|
893
1084
|
if (!args.cancel) {
|
|
894
|
-
if (!isCountRequired(this.parent) && this.dropPosition === 'Invalid') {
|
|
1085
|
+
if (!isCountRequired(this.parent) && (this.dropPosition === 'Invalid' && !this.canDrop)) {
|
|
895
1086
|
return;
|
|
896
1087
|
}
|
|
897
1088
|
if (!isCountRequired(this.parent)) {
|
|
@@ -908,9 +1099,15 @@ var RowDD = /** @class */ (function () {
|
|
|
908
1099
|
else {
|
|
909
1100
|
if (args.target && closest(args.target, '#' + tObj.rowDropSettings.targetID) || parentsUntil(args.target, 'e-treegrid') &&
|
|
910
1101
|
parentsUntil(args.target, 'e-treegrid').id === tObj.rowDropSettings.targetID || args.target && document.getElementById(tObj.rowDropSettings.targetID)) {
|
|
1102
|
+
if (this.parent.element.querySelector('.e-errorelem') || !this.canDrop) {
|
|
1103
|
+
this.dropPosition = 'Invalid';
|
|
1104
|
+
}
|
|
911
1105
|
setValue('dropPosition', this.dropPosition, args);
|
|
912
1106
|
tObj.trigger(events.rowDrop, args);
|
|
913
1107
|
if (!args.cancel && tObj.rowDropSettings.targetID) {
|
|
1108
|
+
if (this.dropPosition === 'Invalid' && !this.canDrop) {
|
|
1109
|
+
return;
|
|
1110
|
+
}
|
|
914
1111
|
this.dragDropGrid(args);
|
|
915
1112
|
if (tObj.isLocalData) {
|
|
916
1113
|
tObj.flatData = this.orderToIndex(tObj.flatData);
|
|
@@ -1043,13 +1240,13 @@ var RowDD = /** @class */ (function () {
|
|
|
1043
1240
|
}
|
|
1044
1241
|
};
|
|
1045
1242
|
/**
|
|
1046
|
-
* Retrieves the index of the target row based on its '
|
|
1243
|
+
* Retrieves the index of the target row based on its 'aria-rowindex' attribute.
|
|
1047
1244
|
*
|
|
1048
1245
|
* @param {Element} targetRow - The target row element from which to retrieve the index.
|
|
1049
1246
|
* @returns {number} - The index of the target row, or 0 if the targetRow is null or undefined.
|
|
1050
1247
|
*/
|
|
1051
1248
|
RowDD.prototype.getTargetIdx = function (targetRow) {
|
|
1052
|
-
return targetRow ? parseInt(targetRow.getAttribute('
|
|
1249
|
+
return targetRow ? parseInt(targetRow.getAttribute('aria-rowindex'), 10) - 1 : 0;
|
|
1053
1250
|
};
|
|
1054
1251
|
/**
|
|
1055
1252
|
* Retrieves the parent data of a given record during a row drag-and-drop operation.
|
|
@@ -1112,7 +1309,13 @@ var RowDD = /** @class */ (function () {
|
|
|
1112
1309
|
this.droppedRecord = tObj.getCurrentViewRecords()[parseInt(index.toString(), 10)];
|
|
1113
1310
|
}
|
|
1114
1311
|
else {
|
|
1115
|
-
this.
|
|
1312
|
+
if (!isNullOrUndefined(this.parent.rowDropSettings.targetID)) {
|
|
1313
|
+
var rowsObject = this.parent.grid.getRowsObject();
|
|
1314
|
+
this.droppedRecord = rowsObject.length > 0 ? rowsObject[args.dropIndex].data : undefined;
|
|
1315
|
+
}
|
|
1316
|
+
else {
|
|
1317
|
+
this.droppedRecord = tObj.getCurrentViewRecords()[args.dropIndex];
|
|
1318
|
+
}
|
|
1116
1319
|
}
|
|
1117
1320
|
}
|
|
1118
1321
|
var dragRecords = [];
|
|
@@ -1650,6 +1853,7 @@ var RowDD = /** @class */ (function () {
|
|
|
1650
1853
|
};
|
|
1651
1854
|
/**
|
|
1652
1855
|
* Cleans up resources, event listeners, and DOM elements when the TreeGrid component is destroyed.
|
|
1856
|
+
*
|
|
1653
1857
|
* @returns {void}
|
|
1654
1858
|
*/
|
|
1655
1859
|
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);
|