@syncfusion/ej2-lists 23.1.42 → 23.1.43
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/CHANGELOG.md +8 -0
- 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 +18 -7
- package/dist/es6/ej2-lists.es2015.js.map +1 -1
- package/dist/es6/ej2-lists.es5.js +27 -16
- 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 +7 -7
- package/src/list-view/list-view.d.ts +3 -1
- package/src/list-view/list-view.js +16 -5
- package/src/list-view/virtualization.d.ts +1 -1
- package/src/list-view/virtualization.js +11 -11
- package/dist/ts/common/list-base.ts +0 -1286
- package/dist/ts/component.ts +0 -4
- package/dist/ts/list-view/list-view.ts +0 -2653
- package/dist/ts/list-view/virtualization.ts +0 -1187
- package/dist/ts/sortable/sortable.ts +0 -485
|
@@ -2794,17 +2794,18 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2794
2794
|
*
|
|
2795
2795
|
* @param {Fields} fields - Target item to add the given data as its children (can be null).
|
|
2796
2796
|
*
|
|
2797
|
+
* @param {number} index - Indicates the index where the data to be added.
|
|
2797
2798
|
*/
|
|
2798
|
-
ListView.prototype.addItem = function (data, fields) {
|
|
2799
|
+
ListView.prototype.addItem = function (data, fields, index) {
|
|
2799
2800
|
if (fields === void 0) { fields = undefined; }
|
|
2800
2801
|
var dataSource = this.dataSource instanceof DataManager
|
|
2801
2802
|
? this.localData : this.dataSource;
|
|
2802
|
-
this.addItemInternally(data, fields, dataSource);
|
|
2803
|
+
this.addItemInternally(data, fields, dataSource, index);
|
|
2803
2804
|
};
|
|
2804
|
-
ListView.prototype.addItemInternally = function (data, fields, dataSource) {
|
|
2805
|
+
ListView.prototype.addItemInternally = function (data, fields, dataSource, index) {
|
|
2805
2806
|
if (data instanceof Array) {
|
|
2806
2807
|
if (this.enableVirtualization) {
|
|
2807
|
-
this.virtualizationModule.addItem(data, fields, dataSource);
|
|
2808
|
+
this.virtualizationModule.addItem(data, fields, dataSource, index);
|
|
2808
2809
|
}
|
|
2809
2810
|
else {
|
|
2810
2811
|
var ds = this.findItemFromDS(dataSource, fields);
|
|
@@ -2820,7 +2821,7 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2820
2821
|
// check for whether target is nested level or top level in list
|
|
2821
2822
|
if (ds instanceof Array) {
|
|
2822
2823
|
for (var i = 0; i < data.length; i++) {
|
|
2823
|
-
dataSource.
|
|
2824
|
+
dataSource = this.addItemAtIndex(index, dataSource, data[i]);
|
|
2824
2825
|
this.setViewDataSource(dataSource);
|
|
2825
2826
|
// since it is top level target, get the content container's first child
|
|
2826
2827
|
// as it is always the top level UL
|
|
@@ -2848,6 +2849,16 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2848
2849
|
}
|
|
2849
2850
|
}
|
|
2850
2851
|
};
|
|
2852
|
+
ListView.prototype.addItemAtIndex = function (index, newDataSource, itemData) {
|
|
2853
|
+
var isIndexValid = !(isNullOrUndefined(index)) && index >= 0 && index < newDataSource.length && isNullOrUndefined(this.listBaseOption.fields.groupBy);
|
|
2854
|
+
if (isIndexValid) {
|
|
2855
|
+
newDataSource.splice(index, 0, itemData);
|
|
2856
|
+
}
|
|
2857
|
+
else {
|
|
2858
|
+
newDataSource.push(itemData);
|
|
2859
|
+
}
|
|
2860
|
+
return newDataSource;
|
|
2861
|
+
};
|
|
2851
2862
|
ListView.prototype.addItemInNestedList = function (targetItemData, itemQueue) {
|
|
2852
2863
|
// eslint-disable-next-line
|
|
2853
2864
|
var targetItemId = targetItemData[this.fields.id];
|
|
@@ -3817,11 +3828,11 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3817
3828
|
});
|
|
3818
3829
|
}
|
|
3819
3830
|
};
|
|
3820
|
-
Virtualization.prototype.addItem = function (data, fields, dataSource) {
|
|
3831
|
+
Virtualization.prototype.addItem = function (data, fields, dataSource, index) {
|
|
3821
3832
|
for (var i = 0; i < data.length; i++) {
|
|
3822
3833
|
var currentItem = data[i];
|
|
3823
3834
|
// push the given data to main data array
|
|
3824
|
-
dataSource.
|
|
3835
|
+
dataSource = this.listViewInstance.addItemAtIndex(index, dataSource, currentItem);
|
|
3825
3836
|
// recalculate all the group data or other datasource related things
|
|
3826
3837
|
this.listViewInstance.setViewDataSource(dataSource);
|
|
3827
3838
|
// render list items for first time due to no datasource present earlier
|
|
@@ -3839,16 +3850,16 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3839
3850
|
var ds = this.listViewInstance.findItemFromDS(dataSource, fields);
|
|
3840
3851
|
if (ds instanceof Array) {
|
|
3841
3852
|
if (this.listViewInstance.ulElement) {
|
|
3842
|
-
var
|
|
3853
|
+
var index_1 = this.listViewInstance.curViewDS.indexOf(currentItem);
|
|
3843
3854
|
// inject new list item into DOM
|
|
3844
|
-
this.createAndInjectNewItem(currentItem,
|
|
3855
|
+
this.createAndInjectNewItem(currentItem, index_1);
|
|
3845
3856
|
// check for group header item
|
|
3846
|
-
var curViewDS = this.listViewInstance.curViewDS[
|
|
3857
|
+
var curViewDS = this.listViewInstance.curViewDS[index_1 - 1];
|
|
3847
3858
|
if (curViewDS && curViewDS.isHeader && curViewDS.items.length === 1) {
|
|
3848
3859
|
// target group item index in datasource
|
|
3849
|
-
--
|
|
3860
|
+
--index_1;
|
|
3850
3861
|
// inject new group header into DOM for previously created list item
|
|
3851
|
-
this.createAndInjectNewItem(curViewDS,
|
|
3862
|
+
this.createAndInjectNewItem(curViewDS, index_1);
|
|
3852
3863
|
}
|
|
3853
3864
|
}
|
|
3854
3865
|
// recollect all the list item into collection
|
|
@@ -3858,13 +3869,13 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3858
3869
|
}
|
|
3859
3870
|
else {
|
|
3860
3871
|
// eslint-disable-next-line
|
|
3861
|
-
var
|
|
3872
|
+
var index_2 = this.listViewInstance.curViewDS.indexOf(currentItem);
|
|
3862
3873
|
// virtually new add list item based on the scollbar position
|
|
3863
|
-
this.addUiItem(
|
|
3874
|
+
this.addUiItem(index_2);
|
|
3864
3875
|
// check for group header item needs to be added
|
|
3865
|
-
var curViewDS = this.listViewInstance.curViewDS[
|
|
3876
|
+
var curViewDS = this.listViewInstance.curViewDS[index_2 - 1];
|
|
3866
3877
|
if (curViewDS && curViewDS.isHeader && curViewDS.items.length === 1) {
|
|
3867
|
-
this.addUiItem(
|
|
3878
|
+
this.addUiItem(index_2 - 1);
|
|
3868
3879
|
}
|
|
3869
3880
|
}
|
|
3870
3881
|
}
|