@syncfusion/ej2-lists 26.2.11 → 26.2.14

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 : 26.2.11
3
+ * version : 26.2.14
4
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
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "_from": "@syncfusion/ej2-lists@*",
3
- "_id": "@syncfusion/ej2-lists@26.2.10",
3
+ "_id": "@syncfusion/ej2-lists@26.2.11",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-e9VZtxBNBMjvKnkR/ZCDEZoFEHNz3quZBYeTFE1anFmxMvE0/dcchRahFcctCM2l+/9XW50iTGHHdz7E9ZtM4g==",
5
+ "_integrity": "sha512-yo1HOlO0dHRPbZd8hjUaGhEQ67pOUGo53jAw5GxNQfh5I1B9U6hC2RnbT6MIOHP7b15OelWakWjpIR5AhOJKJA==",
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.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-lists/-/ej2-lists-26.2.10.tgz",
39
- "_shasum": "344ce6844fb6b54c1ed15b98b5d294e2cdb4c4db",
38
+ "_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-lists/-/ej2-lists-26.2.11.tgz",
39
+ "_shasum": "2e63a389c4a6364d3c7002ba5bdad90624c98033",
40
40
  "_spec": "@syncfusion/ej2-lists@*",
41
41
  "_where": "/jenkins/workspace/elease-automation_release_26.1.1/packages/included",
42
42
  "author": {
@@ -46,7 +46,7 @@
46
46
  "dependencies": {
47
47
  "@syncfusion/ej2-base": "~26.2.10",
48
48
  "@syncfusion/ej2-buttons": "~26.2.10",
49
- "@syncfusion/ej2-data": "~26.2.10",
49
+ "@syncfusion/ej2-data": "~26.2.14",
50
50
  "@syncfusion/ej2-popups": "~26.2.11"
51
51
  },
52
52
  "deprecated": false,
@@ -87,7 +87,7 @@
87
87
  "url": "https://github.com/syncfusion/ej2-javascript-ui-controls/tree/master/controls/lists"
88
88
  },
89
89
  "typings": "index.d.ts",
90
- "version": "26.2.11",
90
+ "version": "26.2.14",
91
91
  "sideEffects": false,
92
92
  "homepage": "https://www.syncfusion.com/javascript-ui-controls"
93
93
  }
@@ -445,6 +445,7 @@ export declare class ListView extends Component<HTMLElement> implements INotifyP
445
445
  * Refresh the height of the list item only on enabling the virtualization property.
446
446
  */
447
447
  refreshItemHeight(): void;
448
+ private handleCheckboxState;
448
449
  targetElement: Element;
449
450
  private clickHandler;
450
451
  private removeElement;
@@ -627,6 +627,28 @@ var ListView = /** @class */ (function (_super) {
627
627
  this.virtualizationModule.refreshItemHeight();
628
628
  }
629
629
  };
630
+ ListView.prototype.handleCheckboxState = function (li, checkIcon, checkboxElement, isCheckedBefore, isFocusedBefore, eventArgs, isSetCheckboxLI, textAreaFocus) {
631
+ this.trigger('select', eventArgs, function (observedArgs) {
632
+ if (observedArgs.cancel) {
633
+ if (isSetCheckboxLI ? isCheckedBefore : !isCheckedBefore) {
634
+ checkIcon.classList.add(classNames.checked);
635
+ li.classList.add(classNames.selected);
636
+ }
637
+ else {
638
+ checkIcon.classList.remove(classNames.checked);
639
+ li.classList.remove(classNames.selected);
640
+ }
641
+ checkboxElement.setAttribute('aria-checked', isSetCheckboxLI ? (isCheckedBefore ? 'true' : 'false') : (isCheckedBefore ? 'false' : 'true'));
642
+ merge(eventArgs, { isChecked: checkIcon.classList.contains(classNames.checked) });
643
+ if (isFocusedBefore) {
644
+ li.classList.remove(classNames.focused);
645
+ if (textAreaFocus) {
646
+ textAreaFocus.classList.remove('e-focused');
647
+ }
648
+ }
649
+ }
650
+ });
651
+ };
630
652
  ListView.prototype.clickHandler = function (e) {
631
653
  if (Array.isArray(this.dataSource) && this.dataSource.length === 0) {
632
654
  return;
@@ -668,7 +690,10 @@ var ListView = /** @class */ (function (_super) {
668
690
  var eventArgs = this.selectEventData(li, e);
669
691
  var checkIcon = li.querySelector('.' + classNames.checkboxIcon);
670
692
  merge(eventArgs, { isChecked: checkIcon.classList.contains(classNames.checked) });
671
- this.trigger('select', eventArgs);
693
+ var checkboxElement = li.querySelector('.' + classNames.checkboxWrapper);
694
+ var isCheckedBefore = checkIcon.classList.contains(classNames.checked);
695
+ var isFocusedBefore = li.classList.contains(classNames.focused);
696
+ this.handleCheckboxState(li, checkIcon, checkboxElement, isCheckedBefore, isFocusedBefore, eventArgs, false);
672
697
  }
673
698
  }
674
699
  else if (li.classList.contains(classNames.hasChild)) {
@@ -889,7 +914,13 @@ var ListView = /** @class */ (function (_super) {
889
914
  }
890
915
  var eventArgs = this.selectEventData(li, e);
891
916
  merge(eventArgs, { isChecked: checkIcon ? checkIcon.classList.contains(classNames.checked) : false });
892
- this.trigger('select', eventArgs);
917
+ if (!isNullOrUndefined(li)) {
918
+ var cbElement = li.querySelector('.' + classNames.checkboxWrapper);
919
+ var checkboxIcon = li.querySelector('.' + classNames.checkboxIcon);
920
+ var isCheckedBefore = checkboxIcon.classList.contains(classNames.checked);
921
+ var isFocusedBefore = li.classList.contains(classNames.focused);
922
+ this.handleCheckboxState(li, checkboxIcon, cbElement, isCheckedBefore, isFocusedBefore, eventArgs, false);
923
+ }
893
924
  this.updateSelectedId();
894
925
  }
895
926
  };
@@ -1019,7 +1050,9 @@ var ListView = /** @class */ (function (_super) {
1019
1050
  var checkboxElement = li.querySelector('.' + classNames.checkboxWrapper);
1020
1051
  var checkIcon = checkboxElement.querySelector('.' + classNames.checkboxIcon + '.' + classNames.icon);
1021
1052
  this.removeHover();
1022
- if (!checkIcon.classList.contains(classNames.checked)) {
1053
+ var isCheckedBefore = checkIcon.classList.contains(classNames.checked);
1054
+ var isFocusedBefore = li.classList.contains(classNames.focused);
1055
+ if (!isCheckedBefore) {
1023
1056
  checkIcon.classList.add(classNames.checked);
1024
1057
  li.classList.add(classNames.selected);
1025
1058
  }
@@ -1034,7 +1067,7 @@ var ListView = /** @class */ (function (_super) {
1034
1067
  if (this.enableVirtualization) {
1035
1068
  this.virtualizationModule.setCheckboxLI(li, e);
1036
1069
  }
1037
- this.trigger('select', eventArgs);
1070
+ this.handleCheckboxState(li, checkIcon, checkboxElement, isCheckedBefore, isFocusedBefore, eventArgs, true, textAreaFocus);
1038
1071
  this.setSelectedItemData(li);
1039
1072
  this.renderSubList(li);
1040
1073
  }
@@ -1103,6 +1136,10 @@ var ListView = /** @class */ (function (_super) {
1103
1136
  _this.selectedLI = li;
1104
1137
  _this.renderSubList(li);
1105
1138
  }
1139
+ else {
1140
+ li.classList.remove(classNames.selected);
1141
+ _this.selectedLI = li;
1142
+ }
1106
1143
  });
1107
1144
  }
1108
1145
  };
@@ -1321,6 +1358,9 @@ var ListView = /** @class */ (function (_super) {
1321
1358
  var ele = this.element.querySelector('[pid=\'' + uID + '\']');
1322
1359
  this.curDSLevel.push(uID);
1323
1360
  this.setViewDataSource(this.getSubDS());
1361
+ if (this.enableVirtualization) {
1362
+ this.virtualizationModule.updateDOMItemCount();
1363
+ }
1324
1364
  if (!ele) {
1325
1365
  var data = this.curViewDS;
1326
1366
  ele = ListBase.createListFromJson(this.createElement, data, this.listBaseOption, this.curDSLevel.length, null, this);
@@ -1429,6 +1469,9 @@ var ListView = /** @class */ (function (_super) {
1429
1469
  }
1430
1470
  this.curDSLevel.pop();
1431
1471
  this.setViewDataSource(this.getSubDS());
1472
+ if (this.enableVirtualization) {
1473
+ this.virtualizationModule.updateDOMItemCount();
1474
+ }
1432
1475
  var toUL = this.element.querySelector('[data-uid=\'' + pID + '\']');
1433
1476
  var fromUL = this.curUL;
1434
1477
  if (!toUL) {
@@ -50,6 +50,7 @@ export declare class Virtualization {
50
50
  uiVirtualization(): void;
51
51
  private wireScrollEvent;
52
52
  private ValidateItemCount;
53
+ updateDOMItemCount(): void;
53
54
  private uiIndicesInitialization;
54
55
  refreshItemHeight(): void;
55
56
  private getscrollerHeight;
@@ -42,7 +42,7 @@ var Virtualization = /** @class */ (function () {
42
42
  this.listViewInstance.contentContainer.appendChild(this.listViewInstance.ulElement);
43
43
  this.listItemHeight = this.listViewInstance.ulElement.firstElementChild.getBoundingClientRect().height;
44
44
  this.expectedDomItemCount = this.ValidateItemCount(10000);
45
- this.domItemCount = this.ValidateItemCount(Object.keys(this.listViewInstance.curViewDS).length);
45
+ this.updateDOMItemCount();
46
46
  var lastIndex = isRendered && !isNullOrUndefined(this.uiLastIndex) ? this.uiLastIndex : this.domItemCount - 1;
47
47
  this.uiFirstIndex = firstIndex;
48
48
  this.uiLastIndex = lastIndex;
@@ -104,6 +104,9 @@ var Virtualization = /** @class */ (function () {
104
104
  }
105
105
  return itemCount;
106
106
  };
107
+ Virtualization.prototype.updateDOMItemCount = function () {
108
+ this.domItemCount = this.ValidateItemCount(Object.keys(this.listViewInstance.curViewDS).length);
109
+ };
107
110
  Virtualization.prototype.uiIndicesInitialization = function () {
108
111
  this.uiIndices = { 'activeIndices': [], 'disabledItemIndices': [], 'hiddenItemIndices': [] };
109
112
  var data = this.listViewInstance.curViewDS;
@@ -403,18 +406,19 @@ var Virtualization = /** @class */ (function () {
403
406
  }
404
407
  };
405
408
  Virtualization.prototype.selectItem = function (obj) {
409
+ var _this = this;
406
410
  var resutJSON = this.findDSAndIndexFromId(this.listViewInstance.curViewDS, obj);
407
411
  if (Object.keys(resutJSON).length) {
408
412
  var isSelected = this.activeIndex === resutJSON.index;
409
- var isChecked = void 0;
413
+ var isChecked_1;
410
414
  this.activeIndex = resutJSON.index;
411
415
  if (this.listViewInstance.showCheckBox) {
412
416
  if (this.uiIndices.activeIndices.indexOf(resutJSON.index) === -1) {
413
- isChecked = true;
417
+ isChecked_1 = true;
414
418
  this.uiIndices.activeIndices.push(resutJSON.index);
415
419
  }
416
420
  else {
417
- isChecked = false;
421
+ isChecked_1 = false;
418
422
  this.uiIndices.activeIndices.splice(this.uiIndices.activeIndices.indexOf(resutJSON.index), 1);
419
423
  }
420
424
  if (this.listViewInstance.curUL.querySelector('.' + classNames.focused)) {
@@ -430,10 +434,10 @@ var Virtualization = /** @class */ (function () {
430
434
  }
431
435
  }
432
436
  else {
433
- var eventArgs = void 0;
437
+ var eventArgs_1;
434
438
  if (typeof this.listViewInstance.dataSource[0] === 'string' ||
435
439
  typeof this.listViewInstance.dataSource[0] === 'number') {
436
- eventArgs = {
440
+ eventArgs_1 = {
437
441
  text: this.listViewInstance.curViewDS[this.activeIndex],
438
442
  data: this.listViewInstance.curViewDS[this.activeIndex],
439
443
  index: this.activeIndex
@@ -441,19 +445,33 @@ var Virtualization = /** @class */ (function () {
441
445
  }
442
446
  else {
443
447
  var curViewDS = this.listViewInstance.curViewDS;
444
- eventArgs = {
448
+ eventArgs_1 = {
445
449
  text: curViewDS[this.activeIndex][this.listViewInstance.fields.text],
446
450
  data: curViewDS[this.activeIndex],
447
451
  index: this.activeIndex
448
452
  };
449
453
  }
450
454
  if (this.listViewInstance.showCheckBox) {
451
- eventArgs.isChecked = isChecked;
452
- this.listViewInstance.trigger('select', eventArgs);
455
+ this.listViewInstance.trigger('select', eventArgs_1, function (observedArgs) {
456
+ if (observedArgs.cancel) {
457
+ if (!isChecked_1) {
458
+ eventArgs_1.isChecked = isChecked_1;
459
+ _this.uiIndices.activeIndices.push(resutJSON.index);
460
+ }
461
+ else {
462
+ eventArgs_1.isChecked = !isChecked_1;
463
+ _this.uiIndices.activeIndices.splice(_this.uiIndices.activeIndices.indexOf(resutJSON.index), 1);
464
+ }
465
+ }
466
+ });
453
467
  }
454
468
  else if (!isSelected) {
455
469
  this.listViewInstance.removeSelect();
456
- this.listViewInstance.trigger('select', eventArgs);
470
+ this.listViewInstance.trigger('select', eventArgs_1, function (observedArgs) {
471
+ if (observedArgs.cancel) {
472
+ _this.activeIndex = undefined;
473
+ }
474
+ });
457
475
  }
458
476
  }
459
477
  }