@syncfusion/ej2-dropdowns 34.2.2 → 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;
@@ -14017,7 +14072,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
14017
14072
  if (!eventArgs.cancel) {
14018
14073
  _this.focusAtFirstListItem(true);
14019
14074
  if (_this.popupObj) {
14020
- document.body.appendChild(_this.popupObj.element);
14075
+ var appendToElement = _this.getAppendToElement();
14076
+ appendToElement.appendChild(_this.popupObj.element);
14021
14077
  }
14022
14078
  if (_this.mode === 'CheckBox' && _this.enableGroupCheckBox && !isNullOrUndefined(_this.fields.groupBy)) {
14023
14079
  _this.updateListItems(_this.list.querySelectorAll('li.e-list-item'), _this.mainList.querySelectorAll('li.e-list-item'));
@@ -14595,6 +14651,16 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
14595
14651
  this.onPopupShown(e);
14596
14652
  }
14597
14653
  };
14654
+ MultiSelect.prototype.getAppendToElement = function () {
14655
+ if (this.isAngular) {
14656
+ var cdkPane = this.element && this.element.closest ? this.element.closest('.cdk-overlay-pane') : null;
14657
+ var popoverEl = this.element && this.element.closest ? this.element.closest('[popover]') : null;
14658
+ if (cdkPane && popoverEl) {
14659
+ return cdkPane;
14660
+ }
14661
+ }
14662
+ return document.body;
14663
+ };
14598
14664
  MultiSelect.prototype.refreshSelection = function () {
14599
14665
  var value;
14600
14666
  var element;
@@ -16176,7 +16242,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16176
16242
  else {
16177
16243
  var listUl = this.list && this.list.querySelector('ul');
16178
16244
  var isFullList = this.isReact && this.itemTemplate && listUl != null &&
16179
- listUl.querySelectorAll('.e-list-item').length === this.mainData.length && !this.groupTemplate;
16245
+ listUl.querySelectorAll('.e-list-item').length === this.mainData.length && !this.groupTemplate && this.mode !== 'CheckBox';
16180
16246
  this.onActionComplete(isFullList ? listUl : list, this.mainData);
16181
16247
  }
16182
16248
  this.focusAtLastListItem(data);
@@ -17087,7 +17153,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
17087
17153
  }
17088
17154
  if (!this.popupObj) {
17089
17155
  if (!isNullOrUndefined(this.popupWrapper)) {
17090
- document.body.appendChild(this.popupWrapper);
17156
+ var appendToElement = this.getAppendToElement();
17157
+ appendToElement.appendChild(this.popupWrapper);
17091
17158
  var checkboxFilter = this.popupWrapper.querySelector('.' + FILTERPARENT);
17092
17159
  if (this.mode === 'CheckBox' && !this.allowFiltering && checkboxFilter && this.filterParent) {
17093
17160
  checkboxFilter.remove();
@@ -20132,8 +20199,11 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
20132
20199
  var mainLiLength = _this.ulElement.querySelectorAll('li.' + 'e-list-item').length;
20133
20200
  var liLength = _this.ulElement.querySelectorAll('li.'
20134
20201
  + dropDownBaseClasses.li + '.' + HIDE_LIST).length;
20202
+ var isFilterText = _this.allowFiltering && !isNullOrUndefined(_this.inputElement) &&
20203
+ _this.inputElement.value.trim() !== '';
20204
+ var isRemoteData = _this.dataSource instanceof DataManager;
20135
20205
  if (mainLiLength > 0 && (mainLiLength === liLength) && (liLength === _this.mainData.length) &&
20136
- !(_this.targetElement() !== '' && _this.allowCustomValue)) {
20206
+ !(_this.targetElement() !== '' && _this.allowCustomValue) && (!isRemoteData || !isFilterText)) {
20137
20207
  _this.beforePopupOpen = false;
20138
20208
  return;
20139
20209
  }
@@ -20561,7 +20631,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
20561
20631
  var listParentHeight = formatUnit(this.popupHeight);
20562
20632
  listParent.style.height = (parseInt(listParentHeight, 10)).toString() + 'px';
20563
20633
  listParent.appendChild(item);
20564
- document.body.appendChild(listParent);
20634
+ var appendToElement = this.getAppendToElement();
20635
+ appendToElement.appendChild(listParent);
20565
20636
  this.virtualListHeight = listParent.getBoundingClientRect().height;
20566
20637
  var listItemHeight = Math.ceil(item.getBoundingClientRect().height) +
20567
20638
  parseInt(window.getComputedStyle(item).marginBottom, 10);
@@ -23885,15 +23956,17 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
23885
23956
  };
23886
23957
  ListBox.prototype.KeyUp = function (e) {
23887
23958
  var _this = this;
23888
- if (this.allowFiltering && e.ctrlKey && e.keyCode === 65) {
23959
+ if (this.allowFiltering && ((e.ctrlKey && e.keyCode === 65) || e.keyCode === 16)) {
23889
23960
  e.preventDefault();
23890
23961
  return;
23891
23962
  }
23892
23963
  var isSpecialKey = e.keyCode >= 186 && e.keyCode <= 192;
23964
+ var isBracketKey = e.keyCode === 219 || e.keyCode === 220 || e.keyCode === 221 || e.keyCode === 222;
23893
23965
  var isNumericKeyPadSpecialKey = e.keyCode === 107 || e.keyCode === 109 || e.keyCode === 111;
23894
23966
  var isWordCharacter = e.key && e.key.match(/\w/);
23895
- var isWordAccentCharacter = e.key && e.key.match(/[A-Za-z0-9\u00C0-\u024F ,>/:;\-+=]/);
23896
- if (!isNullOrUndefined(isWordCharacter) || !isNullOrUndefined(isWordAccentCharacter) || isSpecialKey || isNumericKeyPadSpecialKey) {
23967
+ var isWordAccentCharacter = e.key && e.key.match(/[A-Za-z0-9\u00C0-\u024F ,>/:;\-+=[\]\\ '@!#$%^&*()]/);
23968
+ if (!isNullOrUndefined(isWordCharacter) || !isNullOrUndefined(isWordAccentCharacter)
23969
+ || isSpecialKey || isBracketKey || isNumericKeyPadSpecialKey) {
23897
23970
  this.isValidKey = true;
23898
23971
  }
23899
23972
  this.isBackSpace = e.keyCode === 8;
@@ -25959,11 +26032,12 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
25959
26032
  value = this.displayTempElement.innerHTML;
25960
26033
  }
25961
26034
  if (this.isContentEditable(this.inputElement)) {
25962
- var defaultSuffix = this.isRTE ? '&#8203;' : '';
26035
+ var isMozilla = Browser.info.name === 'mozilla';
26036
+ var defaultSuffix = this.isRTE || isMozilla ? '&#8203;' : '';
25963
26037
  if (Browser.isAndroid) {
25964
26038
  return '<span contenteditable="true" class="e-mention-chip">' + showChar + value + '</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : defaultSuffix);
25965
26039
  }
25966
- else if (Browser.info.name === 'mozilla') {
26040
+ else if (isMozilla) {
25967
26041
  return '<span>&#65279;<span contenteditable="false" class="e-mention-chip">' + showChar + value + '</span>&#65279;</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : defaultSuffix);
25968
26042
  }
25969
26043
  else {