@syncfusion/ej2-lists 25.2.3 → 26.2.4
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/.eslintrc.json +3 -2
- package/dist/ej2-lists.min.js +2 -2
- package/dist/ej2-lists.umd.min.js +2 -2
- package/dist/ej2-lists.umd.min.js.map +1 -1
- package/dist/es6/ej2-lists.es2015.js +255 -279
- package/dist/es6/ej2-lists.es2015.js.map +1 -1
- package/dist/es6/ej2-lists.es5.js +241 -265
- package/dist/es6/ej2-lists.es5.js.map +1 -1
- package/dist/global/ej2-lists.min.js +2 -2
- package/dist/global/ej2-lists.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +10 -10
- package/src/common/list-base.d.ts +61 -30
- package/src/common/list-base.js +167 -94
- package/src/list-view/list-view.d.ts +7 -9
- package/src/list-view/list-view.js +42 -75
- package/src/list-view/virtualization.d.ts +0 -1
- package/src/list-view/virtualization.js +10 -66
- package/src/sortable/sortable.d.ts +5 -0
- package/src/sortable/sortable.js +14 -7
- package/styles/bootstrap-dark.css +100 -122
- package/styles/bootstrap-dark.scss +8 -2
- package/styles/bootstrap.css +100 -122
- package/styles/bootstrap.scss +8 -2
- package/styles/bootstrap4.css +139 -161
- package/styles/bootstrap4.scss +8 -2
- package/styles/bootstrap5-dark.css +101 -125
- package/styles/bootstrap5-dark.scss +8 -2
- package/styles/bootstrap5.css +101 -125
- package/styles/bootstrap5.scss +8 -2
- package/styles/fabric-dark.css +100 -122
- package/styles/fabric-dark.scss +8 -2
- package/styles/fabric.css +100 -122
- package/styles/fabric.scss +8 -2
- package/styles/fluent-dark.css +143 -165
- package/styles/fluent-dark.scss +8 -2
- package/styles/fluent.css +143 -165
- package/styles/fluent.scss +8 -2
- package/styles/fluent2.css +1485 -0
- package/styles/fluent2.scss +8 -0
- package/styles/highcontrast-light.css +100 -122
- package/styles/highcontrast-light.scss +8 -2
- package/styles/highcontrast.css +100 -122
- package/styles/highcontrast.scss +8 -2
- package/styles/list-view/_bootstrap4-definition.scss +5 -0
- package/styles/list-view/_bootstrap5.3-definition.scss +132 -0
- package/styles/list-view/_fluent2-definition.scss +132 -0
- package/styles/list-view/_layout.scss +377 -393
- package/styles/list-view/_material3-definition.scss +0 -7
- package/styles/list-view/_theme.scss +85 -96
- package/styles/list-view/bootstrap-dark.css +97 -121
- package/styles/list-view/bootstrap.css +97 -121
- package/styles/list-view/bootstrap4.css +136 -160
- package/styles/list-view/bootstrap5-dark.css +98 -124
- package/styles/list-view/bootstrap5.css +98 -124
- package/styles/list-view/fabric-dark.css +97 -121
- package/styles/list-view/fabric.css +97 -121
- package/styles/list-view/fluent-dark.css +140 -164
- package/styles/list-view/fluent.css +140 -164
- package/styles/list-view/fluent2.css +1455 -0
- package/styles/list-view/fluent2.scss +5 -0
- package/styles/list-view/highcontrast-light.css +97 -121
- package/styles/list-view/highcontrast.css +97 -121
- package/styles/list-view/icons/_bootstrap5.3.scss +8 -0
- package/styles/list-view/icons/_fluent2.scss +10 -0
- package/styles/list-view/material-dark.css +97 -121
- package/styles/list-view/material.css +97 -121
- package/styles/list-view/material3-dark.css +113 -137
- package/styles/list-view/material3.css +113 -137
- package/styles/list-view/tailwind-dark.css +207 -235
- package/styles/list-view/tailwind.css +207 -235
- package/styles/material-dark.css +100 -122
- package/styles/material-dark.scss +8 -2
- package/styles/material.css +100 -122
- package/styles/material.scss +8 -2
- package/styles/material3-dark.css +116 -138
- package/styles/material3-dark.scss +8 -2
- package/styles/material3.css +116 -138
- package/styles/material3.scss +8 -2
- package/styles/sortable/_bootstrap5.3-definition.scss +1 -0
- package/styles/sortable/_fluent2-definition.scss +1 -0
- package/styles/sortable/bootstrap-dark.css +3 -1
- package/styles/sortable/bootstrap.css +3 -1
- package/styles/sortable/bootstrap4.css +3 -1
- package/styles/sortable/bootstrap5-dark.css +3 -1
- package/styles/sortable/bootstrap5.css +3 -1
- package/styles/sortable/fabric-dark.css +3 -1
- package/styles/sortable/fabric.css +3 -1
- package/styles/sortable/fluent-dark.css +3 -1
- package/styles/sortable/fluent.css +3 -1
- package/styles/sortable/fluent2.css +1063 -0
- package/styles/sortable/fluent2.scss +3 -0
- package/styles/sortable/highcontrast-light.css +3 -1
- package/styles/sortable/highcontrast.css +3 -1
- package/styles/sortable/material-dark.css +3 -1
- package/styles/sortable/material.css +3 -1
- package/styles/sortable/material3-dark.css +4 -2
- package/styles/sortable/material3.css +4 -2
- package/styles/sortable/tailwind-dark.css +3 -1
- package/styles/sortable/tailwind.css +3 -1
- package/styles/tailwind-dark.css +210 -236
- package/styles/tailwind-dark.scss +8 -2
- package/styles/tailwind.css +210 -236
- package/styles/tailwind.scss +8 -2
- package/CHANGELOG.md +0 -544
|
@@ -34,9 +34,7 @@ var Virtualization = /** @class */ (function () {
|
|
|
34
34
|
this.wireScrollEvent(false);
|
|
35
35
|
var curViewDS = this.listViewInstance.curViewDS;
|
|
36
36
|
var firstDs = curViewDS.slice(0, 1);
|
|
37
|
-
this.listViewInstance.ulElement = this.listViewInstance.curUL = ListBase.createList(
|
|
38
|
-
// eslint-disable-next-line
|
|
39
|
-
this.listViewInstance.createElement, firstDs, this.listViewInstance.listBaseOption, null, this.listViewInstance);
|
|
37
|
+
this.listViewInstance.ulElement = this.listViewInstance.curUL = ListBase.createList(this.listViewInstance.createElement, firstDs, this.listViewInstance.listBaseOption, null, this.listViewInstance);
|
|
40
38
|
this.listViewInstance.contentContainer = this.listViewInstance.createElement('div', { className: classNames.container });
|
|
41
39
|
this.listViewInstance.element.appendChild(this.listViewInstance.contentContainer);
|
|
42
40
|
this.listViewInstance.contentContainer.appendChild(this.listViewInstance.ulElement);
|
|
@@ -46,9 +44,7 @@ var Virtualization = /** @class */ (function () {
|
|
|
46
44
|
this.uiFirstIndex = 0;
|
|
47
45
|
this.uiLastIndex = this.domItemCount - 1;
|
|
48
46
|
var otherDs = curViewDS.slice(1, this.domItemCount);
|
|
49
|
-
var listItems = ListBase.createListItemFromJson(
|
|
50
|
-
// eslint-disable-next-line
|
|
51
|
-
this.listViewInstance.createElement, otherDs, this.listViewInstance.listBaseOption, null, null, this.listViewInstance);
|
|
47
|
+
var listItems = ListBase.createListItemFromJson(this.listViewInstance.createElement, otherDs, this.listViewInstance.listBaseOption, null, null, this.listViewInstance);
|
|
52
48
|
append(listItems, this.listViewInstance.ulElement);
|
|
53
49
|
this.listViewInstance.liCollection = this.listViewInstance.curUL.querySelectorAll('li');
|
|
54
50
|
this.topElement = this.listViewInstance.createElement('div');
|
|
@@ -80,31 +76,9 @@ var Virtualization = /** @class */ (function () {
|
|
|
80
76
|
}
|
|
81
77
|
else {
|
|
82
78
|
EventHandler.remove(this.listViewInstance.element, 'scroll', this.onVirtualUiScroll);
|
|
83
|
-
EventHandler.remove(this.listViewInstance.element, 'scroll', this.updateUlContainer);
|
|
84
79
|
}
|
|
85
80
|
}
|
|
86
81
|
};
|
|
87
|
-
Virtualization.prototype.updateUlContainer = function (e) {
|
|
88
|
-
var listDiff;
|
|
89
|
-
var virtualElementContainer = this.listViewInstance.ulElement.querySelector('.' + classNames.virtualElementContainer);
|
|
90
|
-
if (isNullOrUndefined(this.listViewInstance.liElementHeight)) {
|
|
91
|
-
this.listViewInstance.updateLiElementHeight();
|
|
92
|
-
}
|
|
93
|
-
if (this.listViewInstance.isWindow) {
|
|
94
|
-
// eslint-disable-next-line
|
|
95
|
-
listDiff = Math.round(e.target.documentElement.scrollTop / this.listViewInstance.liElementHeight) - 2;
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
// eslint-disable-next-line
|
|
99
|
-
listDiff = Math.round(e.target.scrollTop / this.listViewInstance.liElementHeight) - 2;
|
|
100
|
-
}
|
|
101
|
-
if (((listDiff - 1) * this.listViewInstance.liElementHeight) < 0) {
|
|
102
|
-
virtualElementContainer.style.top = '0px';
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
virtualElementContainer.style.top = (listDiff) * this.listViewInstance.liElementHeight + 'px';
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
82
|
Virtualization.prototype.ValidateItemCount = function (dataSourceLength) {
|
|
109
83
|
var height = parseFloat(formatUnit(this.listViewInstance.height));
|
|
110
84
|
var itemCount;
|
|
@@ -113,7 +87,6 @@ var Virtualization = /** @class */ (function () {
|
|
|
113
87
|
}
|
|
114
88
|
else {
|
|
115
89
|
if (typeof this.listViewInstance.height === 'string' && this.listViewInstance.height.indexOf('%') !== -1) {
|
|
116
|
-
// eslint-disable-next-line max-len
|
|
117
90
|
itemCount = Math.round((this.listViewInstance.element.getBoundingClientRect().height / this.listItemHeight) * listElementCount);
|
|
118
91
|
}
|
|
119
92
|
else {
|
|
@@ -132,10 +105,8 @@ var Virtualization = /** @class */ (function () {
|
|
|
132
105
|
if (this.listViewInstance.showCheckBox && data[i][this.listViewInstance.fields.isChecked]) {
|
|
133
106
|
this.uiIndices.activeIndices.push(i);
|
|
134
107
|
}
|
|
135
|
-
|
|
136
|
-
if (!isNullOrUndefined(data[i][this.listViewInstance.fields.enabled]) &&
|
|
108
|
+
if (!isNullOrUndefined(data[parseInt(i.toString(), 10)][this.listViewInstance.fields.enabled]) &&
|
|
137
109
|
!data[i][this.listViewInstance.fields.enabled]) {
|
|
138
|
-
// eslint-disable-next-line
|
|
139
110
|
(this.uiIndices.disabledItemIndices.push(i));
|
|
140
111
|
}
|
|
141
112
|
}
|
|
@@ -160,7 +131,7 @@ var Virtualization = /** @class */ (function () {
|
|
|
160
131
|
(pageYOffset - startingHeight)) : ((this.listViewInstance.element.scrollTop - startingHeight) <= 0) ? 0 :
|
|
161
132
|
(this.listViewInstance.element.scrollTop - startingHeight);
|
|
162
133
|
};
|
|
163
|
-
Virtualization.prototype.onVirtualUiScroll = function (
|
|
134
|
+
Virtualization.prototype.onVirtualUiScroll = function () {
|
|
164
135
|
var _a;
|
|
165
136
|
var startingHeight;
|
|
166
137
|
var curViewDS = this.listViewInstance.curViewDS;
|
|
@@ -235,7 +206,6 @@ var Virtualization = /** @class */ (function () {
|
|
|
235
206
|
}
|
|
236
207
|
};
|
|
237
208
|
Virtualization.prototype.updateUiContent = function (element, index) {
|
|
238
|
-
// eslint-disable-next-line
|
|
239
209
|
var curViewDs = this.listViewInstance.curViewDS;
|
|
240
210
|
if (typeof this.listViewInstance.dataSource[0] === 'string' ||
|
|
241
211
|
typeof this.listViewInstance.dataSource[0] === 'number') {
|
|
@@ -244,13 +214,10 @@ var Virtualization = /** @class */ (function () {
|
|
|
244
214
|
this.listViewInstance.curViewDS[index].toString();
|
|
245
215
|
}
|
|
246
216
|
else {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
// eslint-disable-next-line
|
|
250
|
-
(curViewDs[index][this.listViewInstance.fields.id]) : ListBase.generateId();
|
|
217
|
+
element.dataset.uid = (curViewDs[parseInt(index.toString(), 10)][this.listViewInstance.fields.id]) ?
|
|
218
|
+
(curViewDs[parseInt(index.toString(), 10)][this.listViewInstance.fields.id]) : ListBase.generateId();
|
|
251
219
|
element.getElementsByClassName(classNames.listItemText)[0].innerHTML =
|
|
252
|
-
|
|
253
|
-
(curViewDs[index][this.listViewInstance.fields.text]);
|
|
220
|
+
(curViewDs[parseInt(index.toString(), 10)][this.listViewInstance.fields.text]);
|
|
254
221
|
}
|
|
255
222
|
if (this.listViewInstance.showIcon) {
|
|
256
223
|
if (element.querySelector('.' + classNames.listIcon)) {
|
|
@@ -353,9 +320,7 @@ var Virtualization = /** @class */ (function () {
|
|
|
353
320
|
if (!isNullOrUndefined(fields)) {
|
|
354
321
|
ds.some(function (data, index) {
|
|
355
322
|
if ((fields[_this.listViewInstance.fields.id] &&
|
|
356
|
-
// eslint-disable-next-line
|
|
357
323
|
fields[_this.listViewInstance.fields.id]
|
|
358
|
-
// eslint-disable-next-line
|
|
359
324
|
=== (data[_this.listViewInstance.fields.id] && data[_this.listViewInstance.fields.id]) || fields === data)) {
|
|
360
325
|
resultJSON.index = index;
|
|
361
326
|
resultJSON.data = data;
|
|
@@ -383,7 +348,6 @@ var Virtualization = /** @class */ (function () {
|
|
|
383
348
|
}
|
|
384
349
|
return {
|
|
385
350
|
text: dataCollection,
|
|
386
|
-
// eslint-disable-next-line
|
|
387
351
|
data: dataCollection,
|
|
388
352
|
index: this.uiIndices.activeIndices.map(function (index) {
|
|
389
353
|
return _this.listViewInstance.dataSource.indexOf(curViewDS_1[index]);
|
|
@@ -405,15 +369,12 @@ var Virtualization = /** @class */ (function () {
|
|
|
405
369
|
var indexArray = this.uiIndices.activeIndices;
|
|
406
370
|
for (var i = 0; i < indexArray.length; i++) {
|
|
407
371
|
textCollection.push(curViewDS_2[indexArray[i]]["" + text]);
|
|
408
|
-
|
|
409
|
-
dataCollection.push(curViewDS_2[indexArray[i]]);
|
|
372
|
+
dataCollection.push(curViewDS_2[indexArray[parseInt(i.toString(), 10)]]);
|
|
410
373
|
}
|
|
411
|
-
// eslint-disable-next-line
|
|
412
374
|
var dataSource_1 = this.listViewInstance.dataSource instanceof DataManager
|
|
413
375
|
? curViewDS_2 : this.listViewInstance.dataSource;
|
|
414
376
|
return {
|
|
415
377
|
text: textCollection,
|
|
416
|
-
// eslint-disable-next-line
|
|
417
378
|
data: dataCollection,
|
|
418
379
|
index: this.uiIndices.activeIndices.map(function (index) {
|
|
419
380
|
return dataSource_1.indexOf(curViewDS_2[index]);
|
|
@@ -421,12 +382,10 @@ var Virtualization = /** @class */ (function () {
|
|
|
421
382
|
};
|
|
422
383
|
}
|
|
423
384
|
else {
|
|
424
|
-
// eslint-disable-next-line
|
|
425
385
|
var dataSource = this.listViewInstance.dataSource instanceof DataManager
|
|
426
386
|
? curViewDS_2 : this.listViewInstance.dataSource;
|
|
427
387
|
return {
|
|
428
388
|
text: curViewDS_2[this.activeIndex][this.listViewInstance.fields.text],
|
|
429
|
-
// eslint-disable-next-line
|
|
430
389
|
data: curViewDS_2[this.activeIndex],
|
|
431
390
|
index: dataSource.indexOf(curViewDS_2[this.activeIndex])
|
|
432
391
|
};
|
|
@@ -438,7 +397,6 @@ var Virtualization = /** @class */ (function () {
|
|
|
438
397
|
}
|
|
439
398
|
};
|
|
440
399
|
Virtualization.prototype.selectItem = function (obj) {
|
|
441
|
-
// eslint-disable-next-line
|
|
442
400
|
var resutJSON = this.findDSAndIndexFromId(this.listViewInstance.curViewDS, obj);
|
|
443
401
|
if (Object.keys(resutJSON).length) {
|
|
444
402
|
var isSelected = this.activeIndex === resutJSON.index;
|
|
@@ -466,7 +424,6 @@ var Virtualization = /** @class */ (function () {
|
|
|
466
424
|
}
|
|
467
425
|
}
|
|
468
426
|
else {
|
|
469
|
-
// eslint-disable-next-line
|
|
470
427
|
var eventArgs = void 0;
|
|
471
428
|
if (typeof this.listViewInstance.dataSource[0] === 'string' ||
|
|
472
429
|
typeof this.listViewInstance.dataSource[0] === 'number') {
|
|
@@ -500,28 +457,24 @@ var Virtualization = /** @class */ (function () {
|
|
|
500
457
|
}
|
|
501
458
|
};
|
|
502
459
|
Virtualization.prototype.enableItem = function (obj) {
|
|
503
|
-
// eslint-disable-next-line
|
|
504
460
|
var resutJSON = this.findDSAndIndexFromId(this.listViewInstance.curViewDS, obj);
|
|
505
461
|
if (Object.keys(resutJSON).length) {
|
|
506
462
|
this.uiIndices.disabledItemIndices.splice(this.uiIndices.disabledItemIndices.indexOf(resutJSON.index), 1);
|
|
507
463
|
}
|
|
508
464
|
};
|
|
509
465
|
Virtualization.prototype.disableItem = function (obj) {
|
|
510
|
-
// eslint-disable-next-line
|
|
511
466
|
var resutJSON = this.findDSAndIndexFromId(this.listViewInstance.curViewDS, obj);
|
|
512
467
|
if (Object.keys(resutJSON).length && this.uiIndices.disabledItemIndices.indexOf(resutJSON.index) === -1) {
|
|
513
468
|
this.uiIndices.disabledItemIndices.push(resutJSON.index);
|
|
514
469
|
}
|
|
515
470
|
};
|
|
516
471
|
Virtualization.prototype.showItem = function (obj) {
|
|
517
|
-
// eslint-disable-next-line
|
|
518
472
|
var resutJSON = this.findDSAndIndexFromId(this.listViewInstance.curViewDS, obj);
|
|
519
473
|
if (Object.keys(resutJSON).length) {
|
|
520
474
|
this.uiIndices.hiddenItemIndices.splice(this.uiIndices.hiddenItemIndices.indexOf(resutJSON.index), 1);
|
|
521
475
|
}
|
|
522
476
|
};
|
|
523
477
|
Virtualization.prototype.hideItem = function (obj) {
|
|
524
|
-
// eslint-disable-next-line
|
|
525
478
|
var resutJSON = this.findDSAndIndexFromId(this.listViewInstance.curViewDS, obj);
|
|
526
479
|
if (Object.keys(resutJSON).length && this.uiIndices.hiddenItemIndices.indexOf(resutJSON.index) === -1) {
|
|
527
480
|
this.uiIndices.hiddenItemIndices.push(resutJSON.index);
|
|
@@ -530,7 +483,6 @@ var Virtualization = /** @class */ (function () {
|
|
|
530
483
|
Virtualization.prototype.removeItem = function (obj) {
|
|
531
484
|
var dataSource;
|
|
532
485
|
var curViewDS = this.listViewInstance.curViewDS;
|
|
533
|
-
// eslint-disable-next-line
|
|
534
486
|
var resutJSON = this.findDSAndIndexFromId(curViewDS, obj);
|
|
535
487
|
if (Object.keys(resutJSON).length) {
|
|
536
488
|
dataSource = resutJSON.data;
|
|
@@ -751,7 +703,6 @@ var Virtualization = /** @class */ (function () {
|
|
|
751
703
|
}
|
|
752
704
|
}
|
|
753
705
|
else {
|
|
754
|
-
// eslint-disable-next-line
|
|
755
706
|
var index_2 = this.listViewInstance.curViewDS.indexOf(currentItem);
|
|
756
707
|
// virtually new add list item based on the scollbar position
|
|
757
708
|
this.addUiItem(index_2);
|
|
@@ -766,9 +717,7 @@ var Virtualization = /** @class */ (function () {
|
|
|
766
717
|
Virtualization.prototype.createAndInjectNewItem = function (itemData, index) {
|
|
767
718
|
// generate li item for given datasource
|
|
768
719
|
var target;
|
|
769
|
-
var li = ListBase.createListItemFromJson(this.listViewInstance.createElement,
|
|
770
|
-
// eslint-disable-next-line
|
|
771
|
-
[itemData], this.listViewInstance.listBaseOption, null, null, this.listViewInstance);
|
|
720
|
+
var li = ListBase.createListItemFromJson(this.listViewInstance.createElement, [itemData], this.listViewInstance.listBaseOption, null, null, this.listViewInstance);
|
|
772
721
|
// check for target element whether to insert before last item or group item
|
|
773
722
|
if ((Object.keys(this.listViewInstance.curViewDS).length - 1) === index) {
|
|
774
723
|
target = this.listViewInstance.curUL.lastElementChild;
|
|
@@ -801,7 +750,6 @@ var Virtualization = /** @class */ (function () {
|
|
|
801
750
|
this.templateData = args.curData.isHeader ? args.curData.items[0] :
|
|
802
751
|
args.curData;
|
|
803
752
|
if (this.listViewInstance.showCheckBox) {
|
|
804
|
-
// eslint-disable-next-line
|
|
805
753
|
this.listViewInstance.renderCheckbox(args);
|
|
806
754
|
if ((!isNullOrUndefined(this.listViewInstance.virtualCheckBox)) &&
|
|
807
755
|
(!isNullOrUndefined(this.listViewInstance.virtualCheckBox.outerHTML))) {
|
|
@@ -857,9 +805,7 @@ var Virtualization = /** @class */ (function () {
|
|
|
857
805
|
var onChange = this.isNgTemplate() ? this.onNgChange : this.onChange;
|
|
858
806
|
if (this.listViewInstance.template || this.listViewInstance.groupTemplate) {
|
|
859
807
|
var curViewDS = this.listViewInstance.curViewDS[index];
|
|
860
|
-
// eslint-disable-next-line
|
|
861
808
|
element.dataset.uid = (curViewDS[this.listViewInstance.fields.id]) ?
|
|
862
|
-
// eslint-disable-next-line
|
|
863
809
|
(curViewDS[this.listViewInstance.fields.id]) : ListBase.generateId();
|
|
864
810
|
onChange(curViewDS, element, this);
|
|
865
811
|
}
|
|
@@ -880,9 +826,7 @@ var Virtualization = /** @class */ (function () {
|
|
|
880
826
|
* @returns {void}
|
|
881
827
|
*/
|
|
882
828
|
Virtualization.prototype.onChange = function (newData, listElement, virtualThis) {
|
|
883
|
-
var liItem = ListBase.createListItemFromJson(virtualThis.listViewInstance.createElement,
|
|
884
|
-
// eslint-disable-next-line
|
|
885
|
-
[newData], virtualThis.listViewInstance.listBaseOption, null, null, virtualThis.listViewInstance);
|
|
829
|
+
var liItem = ListBase.createListItemFromJson(virtualThis.listViewInstance.createElement, [newData], virtualThis.listViewInstance.listBaseOption, null, null, virtualThis.listViewInstance);
|
|
886
830
|
if (virtualThis.listViewInstance.isReact) {
|
|
887
831
|
virtualThis.listViewInstance.renderReactTemplates();
|
|
888
832
|
}
|
|
@@ -118,6 +118,11 @@ export declare class Sortable extends Base<HTMLElement> implements INotifyProper
|
|
|
118
118
|
/**
|
|
119
119
|
* It is used to sort array of elements from source element to destination element.
|
|
120
120
|
*
|
|
121
|
+
* @param {HTMLElement} from - The source element from which to move elements.
|
|
122
|
+
* @param {HTMLElement} [to=from] - The destination element to which to move elements. Defaults to the source element.
|
|
123
|
+
* @param {number[]} [targetIndexes] - The indexes of elements to move. If not provided, all children of the source element will be moved.
|
|
124
|
+
* @param {number} [insertBefore] - The index before which to insert the moved elements in the destination element. If not provided, elements will be appended to the end of the destination element.
|
|
125
|
+
* @returns {void}
|
|
121
126
|
* @private
|
|
122
127
|
*/
|
|
123
128
|
export declare function moveTo(from: HTMLElement, to?: HTMLElement, targetIndexes?: number[], insertBefore?: number): void;
|
package/src/sortable/sortable.js
CHANGED
|
@@ -20,6 +20,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
20
20
|
import { Base, Event, getUniqueID, NotifyPropertyChanges, Property } from '@syncfusion/ej2-base';
|
|
21
21
|
import { closest, Draggable, remove, compareElementParent } from '@syncfusion/ej2-base';
|
|
22
22
|
import { addClass, isNullOrUndefined, getComponent, isBlazor, EventHandler } from '@syncfusion/ej2-base';
|
|
23
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
23
24
|
/**
|
|
24
25
|
* Sortable Module provides support to enable sortable functionality in Dom Elements.
|
|
25
26
|
* ```html
|
|
@@ -41,7 +42,6 @@ var Sortable = /** @class */ (function (_super) {
|
|
|
41
42
|
function Sortable(element, options) {
|
|
42
43
|
var _this = _super.call(this, options, element) || this;
|
|
43
44
|
_this.getHelper = function (e) {
|
|
44
|
-
// eslint-disable-next-line prefer-const
|
|
45
45
|
var target = _this.getSortableElement(e.sender.target);
|
|
46
46
|
if (!_this.isValidTarget(target, _this)) {
|
|
47
47
|
return false;
|
|
@@ -59,7 +59,6 @@ var Sortable = /** @class */ (function (_super) {
|
|
|
59
59
|
document.body.appendChild(element);
|
|
60
60
|
return element;
|
|
61
61
|
};
|
|
62
|
-
// eslint-disable-next-line
|
|
63
62
|
_this.onDrag = function (e) {
|
|
64
63
|
if (!e.target) {
|
|
65
64
|
return;
|
|
@@ -137,7 +136,6 @@ var Sortable = /** @class */ (function (_super) {
|
|
|
137
136
|
});
|
|
138
137
|
}
|
|
139
138
|
};
|
|
140
|
-
// eslint-disable-next-line
|
|
141
139
|
_this.onDragStart = function (e) {
|
|
142
140
|
_this.target = _this.getSortableElement(e.target);
|
|
143
141
|
var cancelDrag = false;
|
|
@@ -164,11 +162,10 @@ var Sortable = /** @class */ (function (_super) {
|
|
|
164
162
|
_this.trigger('dragStart', { event: e.event, element: _this.element, target: _this.target });
|
|
165
163
|
}
|
|
166
164
|
};
|
|
167
|
-
// eslint-disable-next-line
|
|
168
165
|
_this.onDragStop = function (e) {
|
|
169
166
|
var dropInst = _this.getSortableInstance(_this.curTarget);
|
|
170
|
-
var prevIdx;
|
|
171
167
|
var curIdx;
|
|
168
|
+
var prevIdx;
|
|
172
169
|
var handled;
|
|
173
170
|
prevIdx = _this.getIndex(_this.target);
|
|
174
171
|
var isPlaceHolderPresent = _this.isPlaceHolderPresent(dropInst);
|
|
@@ -199,12 +196,17 @@ var Sortable = /** @class */ (function (_super) {
|
|
|
199
196
|
});
|
|
200
197
|
}
|
|
201
198
|
dropInst = _this.getSortableInstance(e.target);
|
|
202
|
-
// eslint-disable-next-line prefer-const
|
|
203
199
|
curIdx = dropInst.element.childElementCount;
|
|
204
200
|
prevIdx = _this.getIndex(_this.target);
|
|
201
|
+
if (dropInst.element.querySelector('.e-list-nrt')) {
|
|
202
|
+
curIdx = curIdx - 1;
|
|
203
|
+
}
|
|
204
|
+
if (_this.curTarget === _this.target && e.target === _this.curTarget) {
|
|
205
|
+
curIdx = prevIdx;
|
|
206
|
+
}
|
|
205
207
|
if (dropInst.element === e.target || (!isPlaceHolderPresent && _this.curTarget === _this.target)) {
|
|
206
208
|
var beforeDropArgs = {
|
|
207
|
-
previousIndex: prevIdx, currentIndex:
|
|
209
|
+
previousIndex: prevIdx, currentIndex: curIdx,
|
|
208
210
|
target: e.target, droppedElement: _this.target, helper: e.helper, cancel: false
|
|
209
211
|
};
|
|
210
212
|
_this.trigger('beforeDrop', beforeDropArgs, function (observedArgs) {
|
|
@@ -452,6 +454,11 @@ export { Sortable };
|
|
|
452
454
|
/**
|
|
453
455
|
* It is used to sort array of elements from source element to destination element.
|
|
454
456
|
*
|
|
457
|
+
* @param {HTMLElement} from - The source element from which to move elements.
|
|
458
|
+
* @param {HTMLElement} [to=from] - The destination element to which to move elements. Defaults to the source element.
|
|
459
|
+
* @param {number[]} [targetIndexes] - The indexes of elements to move. If not provided, all children of the source element will be moved.
|
|
460
|
+
* @param {number} [insertBefore] - The index before which to insert the moved elements in the destination element. If not provided, elements will be appended to the end of the destination element.
|
|
461
|
+
* @returns {void}
|
|
455
462
|
* @private
|
|
456
463
|
*/
|
|
457
464
|
export function moveTo(from, to, targetIndexes, insertBefore) {
|