@syncfusion/ej2-lists 23.1.36 → 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.
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 23.1.36
4
- * Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
3
+ * version : 23.1.43
4
+ * Copyright Syncfusion Inc. 2001 - 2023. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
7
7
  * licensing@syncfusion.com. Any infringement will be prosecuted under
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "_from": "@syncfusion/ej2-lists@*",
3
- "_id": "@syncfusion/ej2-lists@18.22.1",
3
+ "_id": "@syncfusion/ej2-lists@23.1.42",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-JFrpWovANLrajmaJBnTd1sYN4tNzGfUtg0iAOELaO/ArE8T5G9Kmnh+JUqfrpqzy4/3GX7YVRkW3veoLTE+9JQ==",
5
+ "_integrity": "sha512-nZFJBFNTfPXcXNgmiWTzjFhbzstuh0DCafgXcxewrTOPehNusCu3P6oEk+UoPTCzWSXsyKHUaxOP4KkQsCS8CA==",
6
6
  "_location": "/@syncfusion/ej2-lists",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -35,8 +35,8 @@
35
35
  "/@syncfusion/ej2-schedule",
36
36
  "/@syncfusion/ej2-vue-lists"
37
37
  ],
38
- "_resolved": "https://nexus.syncfusion.com/repository/ej2-release/@syncfusion/ej2-lists/-/ej2-lists-18.22.1.tgz",
39
- "_shasum": "0e6368d9418ddf6e513951dc48b73eb3c4728667",
38
+ "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-lists/-/ej2-lists-23.1.42.tgz",
39
+ "_shasum": "833c31a436d2afa9f6963225d61dddbc7166bb6d",
40
40
  "_spec": "@syncfusion/ej2-lists@*",
41
41
  "_where": "/jenkins/workspace/elease-automation_release_23.1.1/packages/included",
42
42
  "author": {
@@ -44,9 +44,9 @@
44
44
  },
45
45
  "bundleDependencies": false,
46
46
  "dependencies": {
47
- "@syncfusion/ej2-base": "~23.1.36",
48
- "@syncfusion/ej2-buttons": "~23.1.36",
49
- "@syncfusion/ej2-data": "~23.1.36"
47
+ "@syncfusion/ej2-base": "~23.1.41",
48
+ "@syncfusion/ej2-buttons": "~23.1.43",
49
+ "@syncfusion/ej2-data": "~23.1.43"
50
50
  },
51
51
  "deprecated": false,
52
52
  "description": "The listview control allows you to select an item or multiple items from a list-like interface and represents the data in interactive hierarchical structure across different layouts or views.",
@@ -86,7 +86,7 @@
86
86
  "url": "https://github.com/syncfusion/ej2-javascript-ui-controls/tree/master/controls/lists"
87
87
  },
88
88
  "typings": "index.d.ts",
89
- "version": "23.1.36",
89
+ "version": "23.1.43",
90
90
  "sideEffects": false,
91
91
  "homepage": "https://www.syncfusion.com/javascript-ui-controls"
92
92
  }
@@ -556,11 +556,13 @@ export declare class ListView extends Component<HTMLElement> implements INotifyP
556
556
  *
557
557
  * @param {Fields} fields - Target item to add the given data as its children (can be null).
558
558
  *
559
+ * @param {number} index - Indicates the index where the data to be added.
559
560
  */
560
561
  addItem(data: {
561
562
  [key: string]: Object;
562
- }[], fields?: Fields): void;
563
+ }[], fields?: Fields, index?: number): void;
563
564
  private addItemInternally;
565
+ private addItemAtIndex;
564
566
  private addItemInNestedList;
565
567
  private addItemIntoDom;
566
568
  private addListItem;
@@ -1773,17 +1773,18 @@ var ListView = /** @class */ (function (_super) {
1773
1773
  *
1774
1774
  * @param {Fields} fields - Target item to add the given data as its children (can be null).
1775
1775
  *
1776
+ * @param {number} index - Indicates the index where the data to be added.
1776
1777
  */
1777
- ListView.prototype.addItem = function (data, fields) {
1778
+ ListView.prototype.addItem = function (data, fields, index) {
1778
1779
  if (fields === void 0) { fields = undefined; }
1779
1780
  var dataSource = this.dataSource instanceof DataManager
1780
1781
  ? this.localData : this.dataSource;
1781
- this.addItemInternally(data, fields, dataSource);
1782
+ this.addItemInternally(data, fields, dataSource, index);
1782
1783
  };
1783
- ListView.prototype.addItemInternally = function (data, fields, dataSource) {
1784
+ ListView.prototype.addItemInternally = function (data, fields, dataSource, index) {
1784
1785
  if (data instanceof Array) {
1785
1786
  if (this.enableVirtualization) {
1786
- this.virtualizationModule.addItem(data, fields, dataSource);
1787
+ this.virtualizationModule.addItem(data, fields, dataSource, index);
1787
1788
  }
1788
1789
  else {
1789
1790
  var ds = this.findItemFromDS(dataSource, fields);
@@ -1799,7 +1800,7 @@ var ListView = /** @class */ (function (_super) {
1799
1800
  // check for whether target is nested level or top level in list
1800
1801
  if (ds instanceof Array) {
1801
1802
  for (var i = 0; i < data.length; i++) {
1802
- dataSource.push(data[i]);
1803
+ dataSource = this.addItemAtIndex(index, dataSource, data[i]);
1803
1804
  this.setViewDataSource(dataSource);
1804
1805
  // since it is top level target, get the content container's first child
1805
1806
  // as it is always the top level UL
@@ -1827,6 +1828,16 @@ var ListView = /** @class */ (function (_super) {
1827
1828
  }
1828
1829
  }
1829
1830
  };
1831
+ ListView.prototype.addItemAtIndex = function (index, newDataSource, itemData) {
1832
+ var isIndexValid = !(isNullOrUndefined(index)) && index >= 0 && index < newDataSource.length && isNullOrUndefined(this.listBaseOption.fields.groupBy);
1833
+ if (isIndexValid) {
1834
+ newDataSource.splice(index, 0, itemData);
1835
+ }
1836
+ else {
1837
+ newDataSource.push(itemData);
1838
+ }
1839
+ return newDataSource;
1840
+ };
1830
1841
  ListView.prototype.addItemInNestedList = function (targetItemData, itemQueue) {
1831
1842
  // eslint-disable-next-line
1832
1843
  var targetItemId = targetItemData[this.fields.id];
@@ -77,7 +77,7 @@ export declare class Virtualization {
77
77
  private addUiItem;
78
78
  private removeUiItem;
79
79
  private changeUiIndices;
80
- addItem(data: DataSource[], fields: Fields, dataSource: DataSource[]): void;
80
+ addItem(data: DataSource[], fields: Fields, dataSource: DataSource[], index: number): void;
81
81
  private createAndInjectNewItem;
82
82
  createUIItem(args: ItemCreatedArgs): void;
83
83
  private compileTemplate;
@@ -706,11 +706,11 @@ var Virtualization = /** @class */ (function () {
706
706
  });
707
707
  }
708
708
  };
709
- Virtualization.prototype.addItem = function (data, fields, dataSource) {
709
+ Virtualization.prototype.addItem = function (data, fields, dataSource, index) {
710
710
  for (var i = 0; i < data.length; i++) {
711
711
  var currentItem = data[i];
712
712
  // push the given data to main data array
713
- dataSource.push(currentItem);
713
+ dataSource = this.listViewInstance.addItemAtIndex(index, dataSource, currentItem);
714
714
  // recalculate all the group data or other datasource related things
715
715
  this.listViewInstance.setViewDataSource(dataSource);
716
716
  // render list items for first time due to no datasource present earlier
@@ -728,16 +728,16 @@ var Virtualization = /** @class */ (function () {
728
728
  var ds = this.listViewInstance.findItemFromDS(dataSource, fields);
729
729
  if (ds instanceof Array) {
730
730
  if (this.listViewInstance.ulElement) {
731
- var index = this.listViewInstance.curViewDS.indexOf(currentItem);
731
+ var index_1 = this.listViewInstance.curViewDS.indexOf(currentItem);
732
732
  // inject new list item into DOM
733
- this.createAndInjectNewItem(currentItem, index);
733
+ this.createAndInjectNewItem(currentItem, index_1);
734
734
  // check for group header item
735
- var curViewDS = this.listViewInstance.curViewDS[index - 1];
735
+ var curViewDS = this.listViewInstance.curViewDS[index_1 - 1];
736
736
  if (curViewDS && curViewDS.isHeader && curViewDS.items.length === 1) {
737
737
  // target group item index in datasource
738
- --index;
738
+ --index_1;
739
739
  // inject new group header into DOM for previously created list item
740
- this.createAndInjectNewItem(curViewDS, index);
740
+ this.createAndInjectNewItem(curViewDS, index_1);
741
741
  }
742
742
  }
743
743
  // recollect all the list item into collection
@@ -747,13 +747,13 @@ var Virtualization = /** @class */ (function () {
747
747
  }
748
748
  else {
749
749
  // eslint-disable-next-line
750
- var index = this.listViewInstance.curViewDS.indexOf(currentItem);
750
+ var index_2 = this.listViewInstance.curViewDS.indexOf(currentItem);
751
751
  // virtually new add list item based on the scollbar position
752
- this.addUiItem(index);
752
+ this.addUiItem(index_2);
753
753
  // check for group header item needs to be added
754
- var curViewDS = this.listViewInstance.curViewDS[index - 1];
754
+ var curViewDS = this.listViewInstance.curViewDS[index_2 - 1];
755
755
  if (curViewDS && curViewDS.isHeader && curViewDS.items.length === 1) {
756
- this.addUiItem(index - 1);
756
+ this.addUiItem(index_2 - 1);
757
757
  }
758
758
  }
759
759
  }