@syncfusion/ej2-dropdowns 19.3.47 → 19.3.56

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.
@@ -2129,7 +2129,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
2129
2129
  if (this.isSelectFocusItem(focusEle)) {
2130
2130
  this.setSelection(focusEle, e);
2131
2131
  }
2132
- else {
2132
+ else if (!isNullOrUndefined(this.liCollections)) {
2133
2133
  var index = e.action === 'down' ? this.activeIndex + 1 : this.activeIndex - 1;
2134
2134
  var startIndex = 0;
2135
2135
  if (this.getModuleName() === 'autocomplete') {
@@ -4319,6 +4319,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
4319
4319
  // eslint-disable-next-line
4320
4320
  _this.selectedData = [];
4321
4321
  _this.filterDelayTime = 300;
4322
+ _this.isClicked = false;
4322
4323
  return _this;
4323
4324
  }
4324
4325
  /**
@@ -4804,7 +4805,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
4804
4805
  this.trigger('blur');
4805
4806
  };
4806
4807
  DropDownTree.prototype.updateView = function () {
4807
- if ((!this.showCheckBox && !this.allowMultiSelection) || this.mode === 'Custom') {
4808
+ if ((!this.showCheckBox && !this.allowMultiSelection) || this.mode === 'Custom' || this.inputFocus) {
4808
4809
  return;
4809
4810
  }
4810
4811
  if (this.mode !== 'Box') {
@@ -5246,10 +5247,10 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
5246
5247
  this.inputWrapper.insertBefore(this.chipWrapper, this.hiddenElement);
5247
5248
  addClass([this.inputWrapper], SHOW_CHIP);
5248
5249
  var isValid = this.getValidMode();
5249
- if (isValid && this.value !== null) {
5250
+ if (isValid && this.value !== null && (this.value && this.value.length !== 0)) {
5250
5251
  addClass([this.inputEle], CHIP_INPUT);
5251
5252
  }
5252
- else if (this.value === null) {
5253
+ else if (this.value === null || (this.value && this.value.length === 0)) {
5253
5254
  addClass([this.chipWrapper], HIDEICON);
5254
5255
  }
5255
5256
  }
@@ -5290,8 +5291,10 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
5290
5291
  }
5291
5292
  this.checkWrapper = closest(target, '.' + CHECKBOXWRAP);
5292
5293
  if (!isNullOrUndefined(this.checkWrapper)) {
5294
+ this.isClicked = true;
5293
5295
  var checkElement = select('.' + CHECKBOXFRAME, this.checkWrapper);
5294
5296
  this.changeState(this.checkWrapper, checkElement.classList.contains(CHECK) ? 'uncheck' : 'check', e);
5297
+ this.isClicked = false;
5295
5298
  }
5296
5299
  e.preventDefault();
5297
5300
  };
@@ -5513,6 +5516,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
5513
5516
  }
5514
5517
  };
5515
5518
  DropDownTree.prototype.setValidValue = function () {
5519
+ var _this = this;
5516
5520
  if (!this.showCheckBox && !this.allowMultiSelection) {
5517
5521
  Input.setValue(this.text, this.inputEle, this.floatLabelType);
5518
5522
  var id = this.value[0].toString();
@@ -5522,10 +5526,14 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
5522
5526
  }
5523
5527
  else {
5524
5528
  if (this.showCheckBox) {
5525
- this.treeObj.checkedNodes = this.value.slice();
5526
- setValue('selectedNodes', [], this.treeObj);
5527
- this.treeObj.dataBind();
5528
- this.setMultiSelect();
5529
+ var difference = this.value.filter(function (e) {
5530
+ return _this.treeObj.checkedNodes.indexOf(e) === -1;
5531
+ });
5532
+ if (difference.length > 0 || this.treeSettings.autoCheck) {
5533
+ this.treeObj.checkedNodes = this.value.slice();
5534
+ this.treeObj.dataBind();
5535
+ this.setMultiSelect();
5536
+ }
5529
5537
  }
5530
5538
  else {
5531
5539
  this.treeObj.selectedNodes = this.value.slice();
@@ -5991,7 +5999,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
5991
5999
  }
5992
6000
  var eventArgs = {
5993
6001
  action: this.showCheckBox ? state : args.action,
5994
- isInteracted: args.isInteracted,
6002
+ isInteracted: this.isClicked ? true : args.isInteracted,
5995
6003
  item: args.node,
5996
6004
  itemData: this.showCheckBox ? checkData[0] : selectData
5997
6005
  };
@@ -6062,6 +6070,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
6062
6070
  }
6063
6071
  var target = args.event.target;
6064
6072
  if ((target.classList.contains('e-fullrow') || target.classList.contains('e-list-text')) && this.showCheckBox) {
6073
+ this.isClicked = true;
6065
6074
  // eslint-disable-next-line
6066
6075
  var getNodeDetails = this.treeObj.getNode(args.node);
6067
6076
  if (getNodeDetails.isChecked === 'true') {
@@ -6070,6 +6079,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
6070
6079
  else {
6071
6080
  this.treeObj.checkAll([args.node]);
6072
6081
  }
6082
+ this.isClicked = false;
6073
6083
  this.setMultiSelect();
6074
6084
  this.ensurePlaceHolder();
6075
6085
  }
@@ -6561,6 +6571,9 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
6561
6571
  this.ensurePlaceHolder();
6562
6572
  };
6563
6573
  DropDownTree.prototype.resetValue = function (isDynamicChange) {
6574
+ if (this.value == [] && this.text == null) {
6575
+ return;
6576
+ }
6564
6577
  Input.setValue(null, this.inputEle, this.floatLabelType);
6565
6578
  if (!isDynamicChange) {
6566
6579
  this.oldValue = this.value;
@@ -6572,7 +6585,8 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
6572
6585
  setValue('selectedNodes', [], this.treeObj);
6573
6586
  this.hiddenElement.innerHTML = '';
6574
6587
  if (this.showCheckBox) {
6575
- this.treeObj.uncheckAll();
6588
+ this.treeObj.checkedNodes = [];
6589
+ this.treeObj.dataBind();
6576
6590
  this.setMultiSelect();
6577
6591
  this.clearCheckAll();
6578
6592
  }
@@ -6950,8 +6964,8 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
6950
6964
  this.updateTemplate();
6951
6965
  }
6952
6966
  this.treeObj.sortOrder = newProp.sortOrder;
6953
- this.updateValue(this.value);
6954
6967
  this.treeObj.dataBind();
6968
+ this.updateValue(this.value);
6955
6969
  break;
6956
6970
  case 'showDropDownIcon':
6957
6971
  this.updateDropDownIconState(newProp.showDropDownIcon);
@@ -9512,6 +9526,18 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
9512
9526
  }
9513
9527
  this.inputFocus = false;
9514
9528
  this.overAllWrapper.classList.remove(FOCUS);
9529
+ if (this.addTagOnBlur) {
9530
+ var dataChecks = this.getValueByText(this.inputElement.value, this.ignoreCase, this.ignoreAccent);
9531
+ var listLiElement = this.findListElement(this.list, 'li', 'data-value', dataChecks);
9532
+ var className = this.hideSelectedItem ? HIDE_LIST : dropDownBaseClasses.selected;
9533
+ var allowChipAddition = (listLiElement && !listLiElement.classList.contains(className)) ? true : false;
9534
+ if (allowChipAddition) {
9535
+ this.updateListSelection(listLiElement, eve);
9536
+ if (this.mode === 'Delimiter') {
9537
+ this.updateDelimeter(this.delimiterChar);
9538
+ }
9539
+ }
9540
+ }
9515
9541
  this.refreshListItems(null);
9516
9542
  if (this.mode !== 'Box' && this.mode !== 'CheckBox') {
9517
9543
  this.updateDelimView();
@@ -9734,6 +9760,13 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
9734
9760
  var focusedItem = this.list.querySelector('.' + dropDownBaseClasses.focus);
9735
9761
  if (!isNullOrUndefined(focusedItem)) {
9736
9762
  this.inputElement.setAttribute('aria-activedescendant', focusedItem.id);
9763
+ if (this.allowFiltering) {
9764
+ var filterInput = this.popupWrapper.querySelector('.' + FILTERINPUT);
9765
+ filterInput && filterInput.setAttribute('aria-activedescendant', focusedItem.id);
9766
+ }
9767
+ else if (this.mode == "CheckBox") {
9768
+ this.overAllWrapper.setAttribute('aria-activedescendant', focusedItem.id);
9769
+ }
9737
9770
  }
9738
9771
  };
9739
9772
  MultiSelect.prototype.homeNavigation = function (isHome) {
@@ -9849,7 +9882,6 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
9849
9882
  this.keyAction = true;
9850
9883
  if (document.activeElement.classList.contains(FILTERINPUT)
9851
9884
  || (this.mode === 'CheckBox' && !this.allowFiltering && document.activeElement !== this.list)) {
9852
- this.list.focus();
9853
9885
  EventHandler.add(this.list, 'keydown', this.onKeyDown, this);
9854
9886
  }
9855
9887
  this.updateAriaAttribute();
@@ -10872,7 +10904,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
10872
10904
  EventHandler.add(this.inputElement, 'input', this.onInput, this);
10873
10905
  }
10874
10906
  EventHandler.add(this.inputElement, 'blur', this.onBlurHandler, this);
10875
- EventHandler.add(this.componentWrapper, 'mousemove', this.mouseIn, this);
10907
+ EventHandler.add(this.componentWrapper, 'mouseover', this.mouseIn, this);
10876
10908
  var formElement = closest(this.inputElement, 'form');
10877
10909
  if (formElement) {
10878
10910
  EventHandler.add(formElement, 'reset', this.resetValueHandler, this);
@@ -11618,16 +11650,12 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
11618
11650
  l10n = new L10n('dropdowns', l10nLocale, this.locale);
11619
11651
  }
11620
11652
  var remainContent = l10n.getConstant('overflowCountTemplate');
11653
+ var totalContent = l10n.getConstant('totalCountTemplate');
11621
11654
  var raminElement = this.createElement('span', {
11622
11655
  className: REMAIN_WRAPPER$1
11623
11656
  });
11624
- var compiledString = compile(remainContent);
11625
- var totalCompiledString = compile(l10n.getConstant('totalCountTemplate'));
11626
- // eslint-disable-next-line
11627
- var remainCompildTemp = compiledString({ 'count': this.value.length }, this, 'overflowCountTemplate', null, !this.isStringTemplate, null, raminElement);
11628
- if (remainCompildTemp && remainCompildTemp.length > 0) {
11629
- raminElement.appendChild(remainCompildTemp[0]);
11630
- }
11657
+ var remainCompildTemp = remainContent.replace('${count}', this.value.length.toString());
11658
+ raminElement.innerText = remainCompildTemp;
11631
11659
  this.viewWrapper.appendChild(raminElement);
11632
11660
  this.renderReactTemplates();
11633
11661
  var remainSize = raminElement.offsetWidth;
@@ -11679,9 +11707,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
11679
11707
  }
11680
11708
  if (remaining > 0) {
11681
11709
  var totalWidth = overAllContainer - downIconWidth - this.clearIconWidth;
11682
- this.viewWrapper.appendChild(this.updateRemainTemplate(raminElement, this.viewWrapper, remaining, compiledString, totalCompiledString, totalWidth));
11710
+ this.viewWrapper.appendChild(this.updateRemainTemplate(raminElement, this.viewWrapper, remaining, remainContent, totalContent, totalWidth));
11683
11711
  this.updateRemainWidth(this.viewWrapper, totalWidth);
11684
- this.updateRemainingText(raminElement, downIconWidth, remaining, compiledString, totalCompiledString);
11712
+ this.updateRemainingText(raminElement, downIconWidth, remaining, remainContent, totalContent);
11685
11713
  }
11686
11714
  }
11687
11715
  else {
@@ -11701,17 +11729,14 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
11701
11729
  viewWrapper.style.width = totalWidth + 'px';
11702
11730
  }
11703
11731
  };
11704
- MultiSelect.prototype.updateRemainTemplate = function (raminElement, viewWrapper, remaining, compiledString, totalCompiledString, totalWidth) {
11732
+ MultiSelect.prototype.updateRemainTemplate = function (raminElement, viewWrapper, remaining, remainContent, totalContent, totalWidth) {
11705
11733
  if (viewWrapper.firstChild && viewWrapper.firstChild.nodeType === 3 && viewWrapper.firstChild.nodeValue === '') {
11706
11734
  viewWrapper.removeChild(viewWrapper.firstChild);
11707
11735
  }
11708
11736
  raminElement.innerHTML = '';
11709
- // eslint-disable-next-line
11710
- var remainTemp = compiledString({ 'count': remaining }, this, 'overflowCountTemplate', null, !this.isStringTemplate, null, raminElement);
11711
- // eslint-disable-next-line
11712
- var totalTemp = totalCompiledString({ 'count': remaining }, this, 'totalCountTemplate', null, !this.isStringTemplate, null, raminElement);
11713
- raminElement.appendChild((viewWrapper.firstChild && viewWrapper.firstChild.nodeType === 3) ?
11714
- remainTemp && remainTemp[0] : totalTemp && totalTemp[0]);
11737
+ var remainTemp = remainContent.replace('${count}', remaining.toString());
11738
+ var totalTemp = totalContent.replace('${count}', remaining.toString());
11739
+ raminElement.innerText = (viewWrapper.firstChild && viewWrapper.firstChild.nodeType === 3) ? remainTemp : totalTemp;
11715
11740
  if (viewWrapper.firstChild && viewWrapper.firstChild.nodeType === 3) {
11716
11741
  viewWrapper.classList.remove(TOTAL_COUNT_WRAPPER$1);
11717
11742
  }
@@ -11721,7 +11746,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
11721
11746
  }
11722
11747
  return raminElement;
11723
11748
  };
11724
- MultiSelect.prototype.updateRemainingText = function (raminElement, downIconWidth, remaining, compiledString, totalCompiledString) {
11749
+ MultiSelect.prototype.updateRemainingText = function (raminElement, downIconWidth, remaining, remainContent, totalContent) {
11725
11750
  var overAllContainer = this.componentWrapper.offsetWidth -
11726
11751
  parseInt(window.getComputedStyle(this.componentWrapper).paddingLeft, 10) -
11727
11752
  parseInt(window.getComputedStyle(this.componentWrapper).paddingRight, 10);
@@ -11740,7 +11765,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
11740
11765
  wrapperleng = this.viewWrapper.offsetWidth;
11741
11766
  }
11742
11767
  var totalWidth = overAllContainer - downIconWidth;
11743
- this.updateRemainTemplate(raminElement, this.viewWrapper, remaining, compiledString, totalCompiledString, totalWidth);
11768
+ this.updateRemainTemplate(raminElement, this.viewWrapper, remaining, remainContent, totalContent, totalWidth);
11744
11769
  }
11745
11770
  };
11746
11771
  MultiSelect.prototype.getOverflowVal = function (index) {
@@ -11775,7 +11800,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
11775
11800
  EventHandler.remove(formElement, 'reset', this.resetValueHandler);
11776
11801
  }
11777
11802
  EventHandler.remove(this.inputElement, 'blur', this.onBlurHandler);
11778
- EventHandler.remove(this.componentWrapper, 'mousemove', this.mouseIn);
11803
+ EventHandler.remove(this.componentWrapper, 'mouseover', this.mouseIn);
11779
11804
  EventHandler.remove(this.componentWrapper, 'mouseout', this.mouseOut);
11780
11805
  EventHandler.remove(this.overAllClear, 'mousedown', this.clearAll);
11781
11806
  EventHandler.remove(this.inputElement, 'paste', this.pasteHandler);
@@ -12746,6 +12771,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
12746
12771
  __decorate$5([
12747
12772
  Property(true)
12748
12773
  ], MultiSelect.prototype, "openOnClick", void 0);
12774
+ __decorate$5([
12775
+ Property(false)
12776
+ ], MultiSelect.prototype, "addTagOnBlur", void 0);
12749
12777
  __decorate$5([
12750
12778
  Event()
12751
12779
  ], MultiSelect.prototype, "change", void 0);
@@ -12939,7 +12967,7 @@ var CheckBoxSelection = /** @__PURE__ @class */ (function () {
12939
12967
  }
12940
12968
  if (this.parent.list.classList.contains('e-nodata') || (this.parent.listData && this.parent.listData.length <= 1 &&
12941
12969
  !(this.parent.isDynamicDataChange)) || (this.parent.isDynamicDataChange &&
12942
- !isNullOrUndefined(this.parent.value) && this.parent.value.length <= 1)) {
12970
+ this.parent.listData && this.parent.listData.length <= 1)) {
12943
12971
  this.checkAllParent.style.display = 'none';
12944
12972
  }
12945
12973
  else {