@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.
@@ -2083,7 +2083,7 @@ let DropDownList = class DropDownList extends DropDownBase {
2083
2083
  if (this.isSelectFocusItem(focusEle)) {
2084
2084
  this.setSelection(focusEle, e);
2085
2085
  }
2086
- else {
2086
+ else if (!isNullOrUndefined(this.liCollections)) {
2087
2087
  let index = e.action === 'down' ? this.activeIndex + 1 : this.activeIndex - 1;
2088
2088
  let startIndex = 0;
2089
2089
  if (this.getModuleName() === 'autocomplete') {
@@ -4235,6 +4235,7 @@ let DropDownTree = class DropDownTree extends Component {
4235
4235
  // eslint-disable-next-line
4236
4236
  this.selectedData = [];
4237
4237
  this.filterDelayTime = 300;
4238
+ this.isClicked = false;
4238
4239
  }
4239
4240
  /**
4240
4241
  * Get the properties to be maintained in the persisted state.
@@ -4717,7 +4718,7 @@ let DropDownTree = class DropDownTree extends Component {
4717
4718
  this.trigger('blur');
4718
4719
  }
4719
4720
  updateView() {
4720
- if ((!this.showCheckBox && !this.allowMultiSelection) || this.mode === 'Custom') {
4721
+ if ((!this.showCheckBox && !this.allowMultiSelection) || this.mode === 'Custom' || this.inputFocus) {
4721
4722
  return;
4722
4723
  }
4723
4724
  if (this.mode !== 'Box') {
@@ -5156,10 +5157,10 @@ let DropDownTree = class DropDownTree extends Component {
5156
5157
  this.inputWrapper.insertBefore(this.chipWrapper, this.hiddenElement);
5157
5158
  addClass([this.inputWrapper], SHOW_CHIP);
5158
5159
  const isValid = this.getValidMode();
5159
- if (isValid && this.value !== null) {
5160
+ if (isValid && this.value !== null && (this.value && this.value.length !== 0)) {
5160
5161
  addClass([this.inputEle], CHIP_INPUT);
5161
5162
  }
5162
- else if (this.value === null) {
5163
+ else if (this.value === null || (this.value && this.value.length === 0)) {
5163
5164
  addClass([this.chipWrapper], HIDEICON);
5164
5165
  }
5165
5166
  }
@@ -5200,8 +5201,10 @@ let DropDownTree = class DropDownTree extends Component {
5200
5201
  }
5201
5202
  this.checkWrapper = closest(target, '.' + CHECKBOXWRAP);
5202
5203
  if (!isNullOrUndefined(this.checkWrapper)) {
5204
+ this.isClicked = true;
5203
5205
  const checkElement = select('.' + CHECKBOXFRAME, this.checkWrapper);
5204
5206
  this.changeState(this.checkWrapper, checkElement.classList.contains(CHECK) ? 'uncheck' : 'check', e);
5207
+ this.isClicked = false;
5205
5208
  }
5206
5209
  e.preventDefault();
5207
5210
  }
@@ -5430,10 +5433,14 @@ let DropDownTree = class DropDownTree extends Component {
5430
5433
  }
5431
5434
  else {
5432
5435
  if (this.showCheckBox) {
5433
- this.treeObj.checkedNodes = this.value.slice();
5434
- setValue('selectedNodes', [], this.treeObj);
5435
- this.treeObj.dataBind();
5436
- this.setMultiSelect();
5436
+ let difference = this.value.filter((e) => {
5437
+ return this.treeObj.checkedNodes.indexOf(e) === -1;
5438
+ });
5439
+ if (difference.length > 0 || this.treeSettings.autoCheck) {
5440
+ this.treeObj.checkedNodes = this.value.slice();
5441
+ this.treeObj.dataBind();
5442
+ this.setMultiSelect();
5443
+ }
5437
5444
  }
5438
5445
  else {
5439
5446
  this.treeObj.selectedNodes = this.value.slice();
@@ -5897,7 +5904,7 @@ let DropDownTree = class DropDownTree extends Component {
5897
5904
  }
5898
5905
  const eventArgs = {
5899
5906
  action: this.showCheckBox ? state : args.action,
5900
- isInteracted: args.isInteracted,
5907
+ isInteracted: this.isClicked ? true : args.isInteracted,
5901
5908
  item: args.node,
5902
5909
  itemData: this.showCheckBox ? checkData[0] : selectData
5903
5910
  };
@@ -5968,6 +5975,7 @@ let DropDownTree = class DropDownTree extends Component {
5968
5975
  }
5969
5976
  const target = args.event.target;
5970
5977
  if ((target.classList.contains('e-fullrow') || target.classList.contains('e-list-text')) && this.showCheckBox) {
5978
+ this.isClicked = true;
5971
5979
  // eslint-disable-next-line
5972
5980
  const getNodeDetails = this.treeObj.getNode(args.node);
5973
5981
  if (getNodeDetails.isChecked === 'true') {
@@ -5976,6 +5984,7 @@ let DropDownTree = class DropDownTree extends Component {
5976
5984
  else {
5977
5985
  this.treeObj.checkAll([args.node]);
5978
5986
  }
5987
+ this.isClicked = false;
5979
5988
  this.setMultiSelect();
5980
5989
  this.ensurePlaceHolder();
5981
5990
  }
@@ -6467,6 +6476,9 @@ let DropDownTree = class DropDownTree extends Component {
6467
6476
  this.ensurePlaceHolder();
6468
6477
  }
6469
6478
  resetValue(isDynamicChange) {
6479
+ if (this.value == [] && this.text == null) {
6480
+ return;
6481
+ }
6470
6482
  Input.setValue(null, this.inputEle, this.floatLabelType);
6471
6483
  if (!isDynamicChange) {
6472
6484
  this.oldValue = this.value;
@@ -6478,7 +6490,8 @@ let DropDownTree = class DropDownTree extends Component {
6478
6490
  setValue('selectedNodes', [], this.treeObj);
6479
6491
  this.hiddenElement.innerHTML = '';
6480
6492
  if (this.showCheckBox) {
6481
- this.treeObj.uncheckAll();
6493
+ this.treeObj.checkedNodes = [];
6494
+ this.treeObj.dataBind();
6482
6495
  this.setMultiSelect();
6483
6496
  this.clearCheckAll();
6484
6497
  }
@@ -6855,8 +6868,8 @@ let DropDownTree = class DropDownTree extends Component {
6855
6868
  this.updateTemplate();
6856
6869
  }
6857
6870
  this.treeObj.sortOrder = newProp.sortOrder;
6858
- this.updateValue(this.value);
6859
6871
  this.treeObj.dataBind();
6872
+ this.updateValue(this.value);
6860
6873
  break;
6861
6874
  case 'showDropDownIcon':
6862
6875
  this.updateDropDownIconState(newProp.showDropDownIcon);
@@ -9363,6 +9376,18 @@ let MultiSelect = class MultiSelect extends DropDownBase {
9363
9376
  }
9364
9377
  this.inputFocus = false;
9365
9378
  this.overAllWrapper.classList.remove(FOCUS);
9379
+ if (this.addTagOnBlur) {
9380
+ const dataChecks = this.getValueByText(this.inputElement.value, this.ignoreCase, this.ignoreAccent);
9381
+ const listLiElement = this.findListElement(this.list, 'li', 'data-value', dataChecks);
9382
+ const className = this.hideSelectedItem ? HIDE_LIST : dropDownBaseClasses.selected;
9383
+ const allowChipAddition = (listLiElement && !listLiElement.classList.contains(className)) ? true : false;
9384
+ if (allowChipAddition) {
9385
+ this.updateListSelection(listLiElement, eve);
9386
+ if (this.mode === 'Delimiter') {
9387
+ this.updateDelimeter(this.delimiterChar);
9388
+ }
9389
+ }
9390
+ }
9366
9391
  this.refreshListItems(null);
9367
9392
  if (this.mode !== 'Box' && this.mode !== 'CheckBox') {
9368
9393
  this.updateDelimView();
@@ -9585,6 +9610,13 @@ let MultiSelect = class MultiSelect extends DropDownBase {
9585
9610
  const focusedItem = this.list.querySelector('.' + dropDownBaseClasses.focus);
9586
9611
  if (!isNullOrUndefined(focusedItem)) {
9587
9612
  this.inputElement.setAttribute('aria-activedescendant', focusedItem.id);
9613
+ if (this.allowFiltering) {
9614
+ var filterInput = this.popupWrapper.querySelector('.' + FILTERINPUT);
9615
+ filterInput && filterInput.setAttribute('aria-activedescendant', focusedItem.id);
9616
+ }
9617
+ else if (this.mode == "CheckBox") {
9618
+ this.overAllWrapper.setAttribute('aria-activedescendant', focusedItem.id);
9619
+ }
9588
9620
  }
9589
9621
  }
9590
9622
  homeNavigation(isHome) {
@@ -9700,7 +9732,6 @@ let MultiSelect = class MultiSelect extends DropDownBase {
9700
9732
  this.keyAction = true;
9701
9733
  if (document.activeElement.classList.contains(FILTERINPUT)
9702
9734
  || (this.mode === 'CheckBox' && !this.allowFiltering && document.activeElement !== this.list)) {
9703
- this.list.focus();
9704
9735
  EventHandler.add(this.list, 'keydown', this.onKeyDown, this);
9705
9736
  }
9706
9737
  this.updateAriaAttribute();
@@ -10719,7 +10750,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
10719
10750
  EventHandler.add(this.inputElement, 'input', this.onInput, this);
10720
10751
  }
10721
10752
  EventHandler.add(this.inputElement, 'blur', this.onBlurHandler, this);
10722
- EventHandler.add(this.componentWrapper, 'mousemove', this.mouseIn, this);
10753
+ EventHandler.add(this.componentWrapper, 'mouseover', this.mouseIn, this);
10723
10754
  const formElement = closest(this.inputElement, 'form');
10724
10755
  if (formElement) {
10725
10756
  EventHandler.add(formElement, 'reset', this.resetValueHandler, this);
@@ -11461,16 +11492,12 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11461
11492
  l10n = new L10n('dropdowns', l10nLocale, this.locale);
11462
11493
  }
11463
11494
  const remainContent = l10n.getConstant('overflowCountTemplate');
11495
+ const totalContent = l10n.getConstant('totalCountTemplate');
11464
11496
  const raminElement = this.createElement('span', {
11465
11497
  className: REMAIN_WRAPPER$1
11466
11498
  });
11467
- const compiledString = compile(remainContent);
11468
- const totalCompiledString = compile(l10n.getConstant('totalCountTemplate'));
11469
- // eslint-disable-next-line
11470
- let remainCompildTemp = compiledString({ 'count': this.value.length }, this, 'overflowCountTemplate', null, !this.isStringTemplate, null, raminElement);
11471
- if (remainCompildTemp && remainCompildTemp.length > 0) {
11472
- raminElement.appendChild(remainCompildTemp[0]);
11473
- }
11499
+ let remainCompildTemp = remainContent.replace('${count}', this.value.length.toString());
11500
+ raminElement.innerText = remainCompildTemp;
11474
11501
  this.viewWrapper.appendChild(raminElement);
11475
11502
  this.renderReactTemplates();
11476
11503
  const remainSize = raminElement.offsetWidth;
@@ -11522,9 +11549,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11522
11549
  }
11523
11550
  if (remaining > 0) {
11524
11551
  const totalWidth = overAllContainer - downIconWidth - this.clearIconWidth;
11525
- this.viewWrapper.appendChild(this.updateRemainTemplate(raminElement, this.viewWrapper, remaining, compiledString, totalCompiledString, totalWidth));
11552
+ this.viewWrapper.appendChild(this.updateRemainTemplate(raminElement, this.viewWrapper, remaining, remainContent, totalContent, totalWidth));
11526
11553
  this.updateRemainWidth(this.viewWrapper, totalWidth);
11527
- this.updateRemainingText(raminElement, downIconWidth, remaining, compiledString, totalCompiledString);
11554
+ this.updateRemainingText(raminElement, downIconWidth, remaining, remainContent, totalContent);
11528
11555
  }
11529
11556
  }
11530
11557
  else {
@@ -11544,17 +11571,14 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11544
11571
  viewWrapper.style.width = totalWidth + 'px';
11545
11572
  }
11546
11573
  }
11547
- updateRemainTemplate(raminElement, viewWrapper, remaining, compiledString, totalCompiledString, totalWidth) {
11574
+ updateRemainTemplate(raminElement, viewWrapper, remaining, remainContent, totalContent, totalWidth) {
11548
11575
  if (viewWrapper.firstChild && viewWrapper.firstChild.nodeType === 3 && viewWrapper.firstChild.nodeValue === '') {
11549
11576
  viewWrapper.removeChild(viewWrapper.firstChild);
11550
11577
  }
11551
11578
  raminElement.innerHTML = '';
11552
- // eslint-disable-next-line
11553
- let remainTemp = compiledString({ 'count': remaining }, this, 'overflowCountTemplate', null, !this.isStringTemplate, null, raminElement);
11554
- // eslint-disable-next-line
11555
- let totalTemp = totalCompiledString({ 'count': remaining }, this, 'totalCountTemplate', null, !this.isStringTemplate, null, raminElement);
11556
- raminElement.appendChild((viewWrapper.firstChild && viewWrapper.firstChild.nodeType === 3) ?
11557
- remainTemp && remainTemp[0] : totalTemp && totalTemp[0]);
11579
+ let remainTemp = remainContent.replace('${count}', remaining.toString());
11580
+ let totalTemp = totalContent.replace('${count}', remaining.toString());
11581
+ raminElement.innerText = (viewWrapper.firstChild && viewWrapper.firstChild.nodeType === 3) ? remainTemp : totalTemp;
11558
11582
  if (viewWrapper.firstChild && viewWrapper.firstChild.nodeType === 3) {
11559
11583
  viewWrapper.classList.remove(TOTAL_COUNT_WRAPPER$1);
11560
11584
  }
@@ -11564,7 +11588,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11564
11588
  }
11565
11589
  return raminElement;
11566
11590
  }
11567
- updateRemainingText(raminElement, downIconWidth, remaining, compiledString, totalCompiledString) {
11591
+ updateRemainingText(raminElement, downIconWidth, remaining, remainContent, totalContent) {
11568
11592
  const overAllContainer = this.componentWrapper.offsetWidth -
11569
11593
  parseInt(window.getComputedStyle(this.componentWrapper).paddingLeft, 10) -
11570
11594
  parseInt(window.getComputedStyle(this.componentWrapper).paddingRight, 10);
@@ -11583,7 +11607,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11583
11607
  wrapperleng = this.viewWrapper.offsetWidth;
11584
11608
  }
11585
11609
  const totalWidth = overAllContainer - downIconWidth;
11586
- this.updateRemainTemplate(raminElement, this.viewWrapper, remaining, compiledString, totalCompiledString, totalWidth);
11610
+ this.updateRemainTemplate(raminElement, this.viewWrapper, remaining, remainContent, totalContent, totalWidth);
11587
11611
  }
11588
11612
  }
11589
11613
  getOverflowVal(index) {
@@ -11618,7 +11642,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11618
11642
  EventHandler.remove(formElement, 'reset', this.resetValueHandler);
11619
11643
  }
11620
11644
  EventHandler.remove(this.inputElement, 'blur', this.onBlurHandler);
11621
- EventHandler.remove(this.componentWrapper, 'mousemove', this.mouseIn);
11645
+ EventHandler.remove(this.componentWrapper, 'mouseover', this.mouseIn);
11622
11646
  EventHandler.remove(this.componentWrapper, 'mouseout', this.mouseOut);
11623
11647
  EventHandler.remove(this.overAllClear, 'mousedown', this.clearAll);
11624
11648
  EventHandler.remove(this.inputElement, 'paste', this.pasteHandler);
@@ -12582,6 +12606,9 @@ __decorate$5([
12582
12606
  __decorate$5([
12583
12607
  Property(true)
12584
12608
  ], MultiSelect.prototype, "openOnClick", void 0);
12609
+ __decorate$5([
12610
+ Property(false)
12611
+ ], MultiSelect.prototype, "addTagOnBlur", void 0);
12585
12612
  __decorate$5([
12586
12613
  Event()
12587
12614
  ], MultiSelect.prototype, "change", void 0);
@@ -12772,7 +12799,7 @@ class CheckBoxSelection {
12772
12799
  }
12773
12800
  if (this.parent.list.classList.contains('e-nodata') || (this.parent.listData && this.parent.listData.length <= 1 &&
12774
12801
  !(this.parent.isDynamicDataChange)) || (this.parent.isDynamicDataChange &&
12775
- !isNullOrUndefined(this.parent.value) && this.parent.value.length <= 1)) {
12802
+ this.parent.listData && this.parent.listData.length <= 1)) {
12776
12803
  this.checkAllParent.style.display = 'none';
12777
12804
  }
12778
12805
  else {