@syncfusion/ej2-lists 20.4.42 → 20.4.50

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,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 20.4.42
3
+ * version : 20.4.50
4
4
  * Copyright Syncfusion Inc. 2001 - 2020. 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
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "_from": "@syncfusion/ej2-lists@*",
3
- "_id": "@syncfusion/ej2-lists@20.4.40",
3
+ "_id": "@syncfusion/ej2-lists@20.4.48",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-fv3jQJnoT5EG0BV9SZrVitrFHm3roa68uhebcqWn+0FEJHcvSG/0Qh3zXF5A9bAnVDnh/6J181Uc7o5okKD69A==",
5
+ "_integrity": "sha512-sixUnbQ4O3qCrAVZsBnjwZUao43Gy0aA2b0i0e1KWOQWrFvfq6oGtM9ENkNf6/2d8l+u7LsYUWOPf3u54PWJ7w==",
6
6
  "_location": "/@syncfusion/ej2-lists",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -34,8 +34,8 @@
34
34
  "/@syncfusion/ej2-schedule",
35
35
  "/@syncfusion/ej2-vue-lists"
36
36
  ],
37
- "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-lists/-/ej2-lists-20.4.40.tgz",
38
- "_shasum": "255209a08f0156984ba397db78102e6f0401c4a7",
37
+ "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-lists/-/ej2-lists-20.4.48.tgz",
38
+ "_shasum": "6a48873abe498b8543d60051615ae1a2120c036c",
39
39
  "_spec": "@syncfusion/ej2-lists@*",
40
40
  "_where": "/jenkins/workspace/ease-automation_release_19.1.0.1/packages/included",
41
41
  "author": {
@@ -43,9 +43,9 @@
43
43
  },
44
44
  "bundleDependencies": false,
45
45
  "dependencies": {
46
- "@syncfusion/ej2-base": "~20.4.42",
47
- "@syncfusion/ej2-buttons": "~20.4.42",
48
- "@syncfusion/ej2-data": "~20.4.42"
46
+ "@syncfusion/ej2-base": "~20.4.48",
47
+ "@syncfusion/ej2-buttons": "~20.4.50",
48
+ "@syncfusion/ej2-data": "~20.4.48"
49
49
  },
50
50
  "deprecated": false,
51
51
  "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.",
@@ -85,7 +85,7 @@
85
85
  "url": "https://github.com/syncfusion/ej2-javascript-ui-controls/tree/master/controls/lists"
86
86
  },
87
87
  "typings": "index.d.ts",
88
- "version": "20.4.42",
88
+ "version": "20.4.50",
89
89
  "sideEffects": false,
90
90
  "homepage": "https://www.syncfusion.com/javascript-ui-controls"
91
91
  }
@@ -487,6 +487,7 @@ export declare class ListView extends Component<HTMLElement> implements INotifyP
487
487
  */
488
488
  selectMultipleItems(item: Fields[] | HTMLElement[] | Element[]): void;
489
489
  private getParentId;
490
+ private updateSelectedId;
490
491
  /**
491
492
  * Gets the details of the currently selected item from the list items.
492
493
  *
@@ -441,7 +441,7 @@ var ListView = /** @class */ (function (_super) {
441
441
  this.currentLiElements = [];
442
442
  this.isNestedList = false;
443
443
  this.selectedData = [];
444
- this.selectedId = [];
444
+ this.selectedId = this.enablePersistence ? this.selectedId : [];
445
445
  this.LISTVIEW_TEMPLATE_ID = "" + this.element.id + LISTVIEW_TEMPLATE_PROPERTY;
446
446
  this.LISTVIEW_GROUPTEMPLATE_ID = "" + this.element.id + LISTVIEW_GROUPTEMPLATE_PROPERTY;
447
447
  this.LISTVIEW_HEADERTEMPLATE_ID = "" + this.element.id + LISTVIEW_HEADERTEMPLATE_PROPERTY;
@@ -453,12 +453,13 @@ var ListView = /** @class */ (function (_super) {
453
453
  this.curUL = this.ulElement = this.liCollection = this.headerEle = this.contentContainer = undefined;
454
454
  };
455
455
  ListView.prototype.renderCheckbox = function (args) {
456
+ var _this = this;
456
457
  if (args.item.classList.contains(classNames.hasChild)) {
457
458
  this.isNestedList = true;
458
459
  }
459
460
  if (this.showCheckBox && this.isValidLI(args.item)) {
460
461
  var checkboxElement = void 0;
461
- var fieldData = void 0;
462
+ var fieldData_1;
462
463
  // eslint-disable-next-line prefer-const
463
464
  checkboxElement = createCheckBox(this.createElement, false, {
464
465
  checked: false, enableRtl: this.enableRtl,
@@ -469,8 +470,14 @@ var ListView = /** @class */ (function (_super) {
469
470
  args.item.classList.add(classNames.itemCheckList);
470
471
  args.item.firstElementChild.classList.add(classNames.checkbox);
471
472
  if (typeof this.dataSource[0] !== 'string' && typeof this.dataSource[0] !== 'number') {
472
- fieldData = getFieldValues(args.curData, this.listBaseOption.fields);
473
- if (fieldData[this.listBaseOption.fields.isChecked]) {
473
+ fieldData_1 = getFieldValues(args.curData, this.listBaseOption.fields);
474
+ if (this.enablePersistence && !isNullOrUndefined(this.selectedId)) {
475
+ var index = this.selectedId.findIndex(function (e) { return e == fieldData_1[_this.listBaseOption.fields.id].toString(); });
476
+ if (index != -1) {
477
+ this.checkInternally(args, checkboxElement);
478
+ }
479
+ }
480
+ else if (fieldData_1[this.listBaseOption.fields.isChecked]) {
474
481
  this.checkInternally(args, checkboxElement);
475
482
  }
476
483
  }
@@ -535,6 +542,7 @@ var ListView = /** @class */ (function (_super) {
535
542
  checkboxIcon.parentElement.setAttribute('aria-checked', checked ? 'true' : 'false');
536
543
  }
537
544
  this.setSelectedItemData(liElement);
545
+ this.updateSelectedId();
538
546
  }
539
547
  };
540
548
  /**
@@ -577,6 +585,7 @@ var ListView = /** @class */ (function (_super) {
577
585
  if (this.enableVirtualization) {
578
586
  this.virtualizationModule.checkedItem(checked);
579
587
  }
588
+ this.updateSelectedId();
580
589
  }
581
590
  };
582
591
  ListView.prototype.setCheckbox = function () {
@@ -692,6 +701,7 @@ var ListView = /** @class */ (function (_super) {
692
701
  }
693
702
  }
694
703
  }
704
+ this.updateSelectedId();
695
705
  };
696
706
  ListView.prototype.removeElement = function (element) {
697
707
  return element && element.parentNode && element.parentNode.removeChild(element);
@@ -881,6 +891,7 @@ var ListView = /** @class */ (function (_super) {
881
891
  var eventArgs = this.selectEventData(li, e);
882
892
  merge(eventArgs, { isChecked: checkIcon ? checkIcon.classList.contains(classNames.checked) : false });
883
893
  this.trigger('select', eventArgs);
894
+ this.updateSelectedId();
884
895
  }
885
896
  };
886
897
  ListView.prototype.keyActionHandler = function (e) {
@@ -1352,7 +1363,7 @@ var ListView = /** @class */ (function (_super) {
1352
1363
  if (this.enableVirtualization) {
1353
1364
  if (Object.keys(this.dataSource).length) {
1354
1365
  if ((this.template || this.groupTemplate) && !this.virtualizationModule.isNgTemplate()) {
1355
- if (this.isReact) {
1366
+ if (this.isReact || this.isVue) {
1356
1367
  if (typeof this.template == "string") {
1357
1368
  this.listBaseOption.template = null;
1358
1369
  }
@@ -1557,6 +1568,16 @@ var ListView = /** @class */ (function (_super) {
1557
1568
  }
1558
1569
  return parentId;
1559
1570
  };
1571
+ ListView.prototype.updateSelectedId = function () {
1572
+ this.selectedId = [];
1573
+ var liCollection = this.curUL.getElementsByClassName(classNames.selected);
1574
+ for (var i = 0; i < liCollection.length; i++) {
1575
+ var tempData = this.getItemData(liCollection[i]);
1576
+ if (tempData[this.listBaseOption.fields.id]) {
1577
+ this.selectedId.push(tempData[this.listBaseOption.fields.id]);
1578
+ }
1579
+ }
1580
+ };
1560
1581
  /**
1561
1582
  * Gets the details of the currently selected item from the list items.
1562
1583
  *
@@ -1991,7 +2012,7 @@ var ListView = /** @class */ (function (_super) {
1991
2012
  ListView.prototype.getPersistData = function () {
1992
2013
  return this.addOnPersist(['cssClass', 'enableRtl', 'htmlAttributes',
1993
2014
  'enable', 'fields', 'animation', 'headerTitle',
1994
- 'sortOrder', 'showIcon', 'height', 'width', 'showCheckBox', 'checkBoxPosition']);
2015
+ 'sortOrder', 'showIcon', 'height', 'width', 'showCheckBox', 'checkBoxPosition', 'selectedId']);
1995
2016
  };
1996
2017
  __decorate([
1997
2018
  Property('')
@@ -37,6 +37,12 @@ export declare class Virtualization {
37
37
  * @private
38
38
  */
39
39
  isNgTemplate(): boolean;
40
+ /**
41
+ * Checks if the platform is a Vue and its template property is a function type.
42
+ *
43
+ * @returns {boolean} indicating the result of the check
44
+ */
45
+ private isVueFunctionTemplate;
40
46
  /**
41
47
  * For internal use only.
42
48
  *
@@ -79,6 +85,14 @@ export declare class Virtualization {
79
85
  private textProperty;
80
86
  reRenderUiVirtualization(): void;
81
87
  private updateUI;
88
+ /**
89
+ * Handles the UI change in vue for the list view.
90
+ *
91
+ * @param {DataSource} newData - The new data source for the list view.
92
+ * @param {ElementContext} listElement - The HTML element context for the list view.
93
+ * @param {Virtualization} virtualThis - The virtualization context for the list view.
94
+ */
95
+ private onVuechange;
82
96
  private onNgChange;
83
97
  getModuleName(): string;
84
98
  destroy(): void;
@@ -17,6 +17,14 @@ var Virtualization = /** @class */ (function () {
17
17
  Virtualization.prototype.isNgTemplate = function () {
18
18
  return !isNullOrUndefined(this.listViewInstance.templateRef) && typeof this.listViewInstance.templateRef !== 'string';
19
19
  };
20
+ /**
21
+ * Checks if the platform is a Vue and its template property is a function type.
22
+ *
23
+ * @returns {boolean} indicating the result of the check
24
+ */
25
+ Virtualization.prototype.isVueFunctionTemplate = function () {
26
+ return this.listViewInstance.isVue && typeof this.listViewInstance.template === 'function';
27
+ };
20
28
  /**
21
29
  * For internal use only.
22
30
  *
@@ -809,10 +817,14 @@ var Virtualization = /** @class */ (function () {
809
817
  this.listViewInstance.template = div.innerHTML;
810
818
  }
811
819
  }
820
+ if (this.isVueFunctionTemplate())
821
+ return;
812
822
  template.innerHTML = this.listViewInstance.template;
813
823
  this.listViewInstance.template = virtualTemplate;
814
824
  }
815
825
  else {
826
+ if (this.isVueFunctionTemplate())
827
+ return;
816
828
  template.innerHTML = this.listViewInstance.template || commonTemplate;
817
829
  }
818
830
  // eslint-disable-next-line
@@ -1095,7 +1107,7 @@ var Virtualization = /** @class */ (function () {
1095
1107
  };
1096
1108
  Virtualization.prototype.updateUI = function (element, index, targetElement) {
1097
1109
  // eslint-disable-next-line @typescript-eslint/ban-types
1098
- var onChange = this.isNgTemplate() ? this.onNgChange : this.onChange;
1110
+ var onChange = this.isNgTemplate() ? this.onNgChange : (this.isVueFunctionTemplate()) ? this.onVuechange : this.onChange;
1099
1111
  if (this.listViewInstance.template || this.listViewInstance.groupTemplate) {
1100
1112
  var curViewDS = this.listViewInstance.curViewDS[index];
1101
1113
  // eslint-disable-next-line
@@ -1112,6 +1124,22 @@ var Virtualization = /** @class */ (function () {
1112
1124
  this.listViewInstance.ulElement.insertBefore(element, targetElement);
1113
1125
  }
1114
1126
  };
1127
+ /**
1128
+ * Handles the UI change in vue for the list view.
1129
+ *
1130
+ * @param {DataSource} newData - The new data source for the list view.
1131
+ * @param {ElementContext} listElement - The HTML element context for the list view.
1132
+ * @param {Virtualization} virtualThis - The virtualization context for the list view.
1133
+ */
1134
+ Virtualization.prototype.onVuechange = function (newData, listElement, virtualThis) {
1135
+ var liItem = ListBase.createListItemFromJson(virtualThis.listViewInstance.createElement,
1136
+ // eslint-disable-next-line
1137
+ [newData], virtualThis.listViewInstance.listBaseOption, null, null, virtualThis.listViewInstance);
1138
+ while (listElement.lastChild) {
1139
+ listElement.removeChild(listElement.lastChild);
1140
+ }
1141
+ listElement.appendChild(liItem[0].firstChild);
1142
+ };
1115
1143
  Virtualization.prototype.onNgChange = function (newData, listElement, virtualThis) {
1116
1144
  // compile given target element with template for new data
1117
1145
  // eslint-disable-next-line
@@ -225,7 +225,7 @@ var Sortable = /** @class */ (function (_super) {
225
225
  _this.target = null;
226
226
  _this.curTarget = null;
227
227
  remove(e.helper);
228
- getComponent(_this.element, Draggable).intDestroy(e.event);
228
+ getComponent(_this.element, 'draggable').intDestroy(e.event);
229
229
  };
230
230
  _this.bind();
231
231
  return _this;