@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.
@@ -10192,6 +10192,17 @@ let DropDownTree = class DropDownTree extends Component {
10192
10192
  this.triggerChangeEvent(this.keyEventArgs);
10193
10193
  this.isValueChange = false;
10194
10194
  }
10195
+ const treeData = this.treeObj.getTreeData();
10196
+ if (this.showCheckBox && this.treeSettings.autoCheck && treeData.length > 0 && this.treeData && this.treeData.length > 0) {
10197
+ for (let i = 0; i < treeData.length; i++) {
10198
+ for (let j = 0; j < this.treeData.length; j++) {
10199
+ if (treeData[i].id === this.treeData[j].id) {
10200
+ this.treeData[j].selected = treeData[i].selected !== undefined ?
10201
+ treeData[i].selected : false;
10202
+ }
10203
+ }
10204
+ }
10205
+ }
10195
10206
  }
10196
10207
  beforeCheck(args) {
10197
10208
  if (args.isInteracted) {
@@ -10503,8 +10514,31 @@ let DropDownTree = class DropDownTree extends Component {
10503
10514
  .filter((childNode) => !isNullOrUndefined(childNode) && !isNullOrUndefined(childNode.pid) && !isNullOrUndefined(childNode.id) && childNode.pid.toString() === parentId)
10504
10515
  .map((childNode) => childNode.id.toString());
10505
10516
  }
10517
+ restoreRootParentValues() {
10518
+ const treeData = this.getFilteredTreeData();
10519
+ treeData.forEach((node) => {
10520
+ if (isNullOrUndefined(node) || isNullOrUndefined(node.id)) {
10521
+ return;
10522
+ }
10523
+ if (isNullOrUndefined(node.pid)) {
10524
+ const rootId = node.id.toString();
10525
+ const currentValues = this.value.map((item) => item.toString());
10526
+ if (currentValues.indexOf(rootId) === -1) {
10527
+ const childValues = [];
10528
+ this.getChildren(rootId, childValues);
10529
+ const hasSelectedChild = childValues.some((childId) => currentValues.indexOf(childId) !== -1);
10530
+ if (hasSelectedChild) {
10531
+ this.value.push(rootId);
10532
+ }
10533
+ }
10534
+ }
10535
+ });
10536
+ }
10506
10537
  updateFilteredAutoCheckValues() {
10507
10538
  const treeData = this.getFilteredTreeData();
10539
+ if (!this.isNodeChecked && Array.isArray(this.value) && this.value.length > 0 && this.showCheckBox) {
10540
+ this.restoreRootParentValues();
10541
+ }
10508
10542
  let currentValues = Array.isArray(this.value) ? this.value.map((item) => item.toString()) : [];
10509
10543
  const removeParent = (parentId) => {
10510
10544
  this.value = this.value.filter((value) => value.toString() !== parentId);
@@ -10593,24 +10627,44 @@ let DropDownTree = class DropDownTree extends Component {
10593
10627
  this.value = this.value.filter((value) => removeValues.indexOf(value.toString()) === -1);
10594
10628
  currentValues = this.value.map((item) => item.toString());
10595
10629
  }
10596
- treeData.forEach((node) => {
10597
- if (isNullOrUndefined(node) || isNullOrUndefined(node.id)) {
10598
- return;
10599
- }
10600
- if (!node.haschild) {
10601
- return;
10602
- }
10603
- const parentId = node.id.toString();
10604
- if (currentValues.indexOf(parentId) === -1) {
10605
- return;
10606
- }
10607
- const hasDirectChild = treeData.some((childNode) => !isNullOrUndefined(childNode) && !isNullOrUndefined(childNode.pid) && !isNullOrUndefined(childNode.id) && childNode.pid.toString() === parentId &&
10608
- currentValues.indexOf(childNode.id.toString()) !== -1);
10609
- if (!hasDirectChild) {
10610
- removeParent(parentId);
10611
- currentValues = this.value.map((item) => item.toString());
10612
- }
10613
- });
10630
+ let stabilized = false;
10631
+ const valueBeforeReconciliation = [...this.value];
10632
+ let iterationCount = 0;
10633
+ const maxIterations = treeData.length + 1;
10634
+ while (!stabilized && iterationCount < maxIterations) {
10635
+ stabilized = true;
10636
+ iterationCount++;
10637
+ treeData.forEach((node) => {
10638
+ if (isNullOrUndefined(node) || isNullOrUndefined(node.id)) {
10639
+ return;
10640
+ }
10641
+ if (!node.haschild) {
10642
+ return;
10643
+ }
10644
+ const parentId = node.id.toString();
10645
+ const directChildren = this.getDirectChildren(parentId);
10646
+ if (!directChildren.length) {
10647
+ return;
10648
+ }
10649
+ const allDirectChildrenChecked = directChildren.every((childId) => currentValues.indexOf(childId) !== -1);
10650
+ if (allDirectChildrenChecked) {
10651
+ if (currentValues.indexOf(parentId) === -1) {
10652
+ this.value.push(parentId);
10653
+ currentValues = this.value.map((item) => item.toString());
10654
+ stabilized = false;
10655
+ }
10656
+ }
10657
+ else if (currentValues.indexOf(parentId) !== -1) {
10658
+ removeParent(parentId);
10659
+ currentValues = this.value.map((item) => item.toString());
10660
+ stabilized = false;
10661
+ }
10662
+ });
10663
+ }
10664
+ if ((valueBeforeReconciliation.length > 0 && this.value.length === 0) ||
10665
+ iterationCount >= maxIterations) {
10666
+ this.value = valueBeforeReconciliation;
10667
+ }
10614
10668
  }
10615
10669
  updateSelectedValues() {
10616
10670
  this.dataValue = '';
@@ -23528,7 +23582,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
23528
23582
  }
23529
23583
  }
23530
23584
  KeyUp(e) {
23531
- if (this.allowFiltering && e.ctrlKey && e.keyCode === 65) {
23585
+ if (this.allowFiltering && ((e.ctrlKey && e.keyCode === 65) || e.keyCode === 16)) {
23532
23586
  e.preventDefault();
23533
23587
  return;
23534
23588
  }
@@ -23536,7 +23590,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
23536
23590
  const isBracketKey = e.keyCode === 219 || e.keyCode === 220 || e.keyCode === 221 || e.keyCode === 222;
23537
23591
  const isNumericKeyPadSpecialKey = e.keyCode === 107 || e.keyCode === 109 || e.keyCode === 111;
23538
23592
  const isWordCharacter = e.key && e.key.match(/\w/);
23539
- const isWordAccentCharacter = e.key && e.key.match(/[A-Za-z0-9\u00C0-\u024F ,>/:;\-+=[\]\\ ']/);
23593
+ const isWordAccentCharacter = e.key && e.key.match(/[A-Za-z0-9\u00C0-\u024F ,>/:;\-+=[\]\\ '@!#$%^&*()]/);
23540
23594
  if (!isNullOrUndefined(isWordCharacter) || !isNullOrUndefined(isWordAccentCharacter)
23541
23595
  || isSpecialKey || isBracketKey || isNumericKeyPadSpecialKey) {
23542
23596
  this.isValidKey = true;