@syncfusion/ej2-dropdowns 34.2.3 → 34.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.
@@ -10384,6 +10384,17 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
10384
10384
  this.triggerChangeEvent(this.keyEventArgs);
10385
10385
  this.isValueChange = false;
10386
10386
  }
10387
+ var treeData = this.treeObj.getTreeData();
10388
+ if (this.showCheckBox && this.treeSettings.autoCheck && treeData.length > 0 && this.treeData && this.treeData.length > 0) {
10389
+ for (var i = 0; i < treeData.length; i++) {
10390
+ for (var j = 0; j < this.treeData.length; j++) {
10391
+ if (treeData[i].id === this.treeData[j].id) {
10392
+ this.treeData[j].selected = treeData[i].selected !== undefined ?
10393
+ treeData[i].selected : false;
10394
+ }
10395
+ }
10396
+ }
10397
+ }
10387
10398
  };
10388
10399
  DropDownTree.prototype.beforeCheck = function (args) {
10389
10400
  if (args.isInteracted) {
@@ -10700,9 +10711,35 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
10700
10711
  })
10701
10712
  .map(function (childNode) { return childNode.id.toString(); });
10702
10713
  };
10714
+ DropDownTree.prototype.restoreRootParentValues = function () {
10715
+ var _this = this;
10716
+ var treeData = this.getFilteredTreeData();
10717
+ treeData.forEach(function (node) {
10718
+ if (isNullOrUndefined(node) || isNullOrUndefined(node.id)) {
10719
+ return;
10720
+ }
10721
+ if (isNullOrUndefined(node.pid)) {
10722
+ var rootId = node.id.toString();
10723
+ var currentValues_1 = _this.value.map(function (item) {
10724
+ return item.toString();
10725
+ });
10726
+ if (currentValues_1.indexOf(rootId) === -1) {
10727
+ var childValues = [];
10728
+ _this.getChildren(rootId, childValues);
10729
+ var hasSelectedChild = childValues.some(function (childId) { return currentValues_1.indexOf(childId) !== -1; });
10730
+ if (hasSelectedChild) {
10731
+ _this.value.push(rootId);
10732
+ }
10733
+ }
10734
+ }
10735
+ });
10736
+ };
10703
10737
  DropDownTree.prototype.updateFilteredAutoCheckValues = function () {
10704
10738
  var _this = this;
10705
10739
  var treeData = this.getFilteredTreeData();
10740
+ if (!this.isNodeChecked && Array.isArray(this.value) && this.value.length > 0 && this.showCheckBox) {
10741
+ this.restoreRootParentValues();
10742
+ }
10706
10743
  var currentValues = Array.isArray(this.value) ? this.value.map(function (item) { return item.toString(); }) : [];
10707
10744
  var removeParent = function (parentId) {
10708
10745
  _this.value = _this.value.filter(function (value) { return value.toString() !== parentId; });
@@ -10793,26 +10830,44 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
10793
10830
  this.value = this.value.filter(function (value) { return removeValues.indexOf(value.toString()) === -1; });
10794
10831
  currentValues = this.value.map(function (item) { return item.toString(); });
10795
10832
  }
10796
- treeData.forEach(function (node) {
10797
- if (isNullOrUndefined(node) || isNullOrUndefined(node.id)) {
10798
- return;
10799
- }
10800
- if (!node.haschild) {
10801
- return;
10802
- }
10803
- var parentId = node.id.toString();
10804
- if (currentValues.indexOf(parentId) === -1) {
10805
- return;
10806
- }
10807
- var hasDirectChild = treeData.some(function (childNode) {
10808
- return !isNullOrUndefined(childNode) && !isNullOrUndefined(childNode.pid) && !isNullOrUndefined(childNode.id) && childNode.pid.toString() === parentId &&
10809
- currentValues.indexOf(childNode.id.toString()) !== -1;
10833
+ var stabilized = false;
10834
+ var valueBeforeReconciliation = this.value.slice();
10835
+ var iterationCount = 0;
10836
+ var maxIterations = treeData.length + 1;
10837
+ while (!stabilized && iterationCount < maxIterations) {
10838
+ stabilized = true;
10839
+ iterationCount++;
10840
+ treeData.forEach(function (node) {
10841
+ if (isNullOrUndefined(node) || isNullOrUndefined(node.id)) {
10842
+ return;
10843
+ }
10844
+ if (!node.haschild) {
10845
+ return;
10846
+ }
10847
+ var parentId = node.id.toString();
10848
+ var directChildren = _this.getDirectChildren(parentId);
10849
+ if (!directChildren.length) {
10850
+ return;
10851
+ }
10852
+ var allDirectChildrenChecked = directChildren.every(function (childId) { return currentValues.indexOf(childId) !== -1; });
10853
+ if (allDirectChildrenChecked) {
10854
+ if (currentValues.indexOf(parentId) === -1) {
10855
+ _this.value.push(parentId);
10856
+ currentValues = _this.value.map(function (item) { return item.toString(); });
10857
+ stabilized = false;
10858
+ }
10859
+ }
10860
+ else if (currentValues.indexOf(parentId) !== -1) {
10861
+ removeParent(parentId);
10862
+ currentValues = _this.value.map(function (item) { return item.toString(); });
10863
+ stabilized = false;
10864
+ }
10810
10865
  });
10811
- if (!hasDirectChild) {
10812
- removeParent(parentId);
10813
- currentValues = _this.value.map(function (item) { return item.toString(); });
10814
- }
10815
- });
10866
+ }
10867
+ if ((valueBeforeReconciliation.length > 0 && this.value.length === 0) ||
10868
+ iterationCount >= maxIterations) {
10869
+ this.value = valueBeforeReconciliation;
10870
+ }
10816
10871
  };
10817
10872
  DropDownTree.prototype.updateSelectedValues = function () {
10818
10873
  var _this = this;
@@ -23901,7 +23956,7 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
23901
23956
  };
23902
23957
  ListBox.prototype.KeyUp = function (e) {
23903
23958
  var _this = this;
23904
- if (this.allowFiltering && e.ctrlKey && e.keyCode === 65) {
23959
+ if (this.allowFiltering && ((e.ctrlKey && e.keyCode === 65) || e.keyCode === 16)) {
23905
23960
  e.preventDefault();
23906
23961
  return;
23907
23962
  }
@@ -23909,7 +23964,7 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
23909
23964
  var isBracketKey = e.keyCode === 219 || e.keyCode === 220 || e.keyCode === 221 || e.keyCode === 222;
23910
23965
  var isNumericKeyPadSpecialKey = e.keyCode === 107 || e.keyCode === 109 || e.keyCode === 111;
23911
23966
  var isWordCharacter = e.key && e.key.match(/\w/);
23912
- var isWordAccentCharacter = e.key && e.key.match(/[A-Za-z0-9\u00C0-\u024F ,>/:;\-+=[\]\\ ']/);
23967
+ var isWordAccentCharacter = e.key && e.key.match(/[A-Za-z0-9\u00C0-\u024F ,>/:;\-+=[\]\\ '@!#$%^&*()]/);
23913
23968
  if (!isNullOrUndefined(isWordCharacter) || !isNullOrUndefined(isWordAccentCharacter)
23914
23969
  || isSpecialKey || isBracketKey || isNumericKeyPadSpecialKey) {
23915
23970
  this.isValidKey = true;