@syncfusion/ej2-dropdowns 19.3.46 → 19.3.55

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.
@@ -4647,9 +4648,6 @@ let DropDownTree = class DropDownTree extends Component {
4647
4648
  this.isClearButtonClick = false;
4648
4649
  return;
4649
4650
  }
4650
- if (!this.wrapText && e.target.classList.contains(CHIP_CLOSE)) {
4651
- this.removeChip(e);
4652
- }
4653
4651
  if (this.isPopupOpen) {
4654
4652
  this.hidePopup();
4655
4653
  }
@@ -4720,7 +4718,7 @@ let DropDownTree = class DropDownTree extends Component {
4720
4718
  this.trigger('blur');
4721
4719
  }
4722
4720
  updateView() {
4723
- if ((!this.showCheckBox && !this.allowMultiSelection) || this.mode === 'Custom') {
4721
+ if ((!this.showCheckBox && !this.allowMultiSelection) || this.mode === 'Custom' || this.inputFocus) {
4724
4722
  return;
4725
4723
  }
4726
4724
  if (this.mode !== 'Box') {
@@ -5159,10 +5157,10 @@ let DropDownTree = class DropDownTree extends Component {
5159
5157
  this.inputWrapper.insertBefore(this.chipWrapper, this.hiddenElement);
5160
5158
  addClass([this.inputWrapper], SHOW_CHIP);
5161
5159
  const isValid = this.getValidMode();
5162
- if (isValid && this.value !== null) {
5160
+ if (isValid && this.value !== null && (this.value && this.value.length !== 0)) {
5163
5161
  addClass([this.inputEle], CHIP_INPUT);
5164
5162
  }
5165
- else if (this.value === null) {
5163
+ else if (this.value === null || (this.value && this.value.length === 0)) {
5166
5164
  addClass([this.chipWrapper], HIDEICON);
5167
5165
  }
5168
5166
  }
@@ -5203,8 +5201,10 @@ let DropDownTree = class DropDownTree extends Component {
5203
5201
  }
5204
5202
  this.checkWrapper = closest(target, '.' + CHECKBOXWRAP);
5205
5203
  if (!isNullOrUndefined(this.checkWrapper)) {
5204
+ this.isClicked = true;
5206
5205
  const checkElement = select('.' + CHECKBOXFRAME, this.checkWrapper);
5207
5206
  this.changeState(this.checkWrapper, checkElement.classList.contains(CHECK) ? 'uncheck' : 'check', e);
5207
+ this.isClicked = false;
5208
5208
  }
5209
5209
  e.preventDefault();
5210
5210
  }
@@ -5434,7 +5434,6 @@ let DropDownTree = class DropDownTree extends Component {
5434
5434
  else {
5435
5435
  if (this.showCheckBox) {
5436
5436
  this.treeObj.checkedNodes = this.value.slice();
5437
- setValue('selectedNodes', [], this.treeObj);
5438
5437
  this.treeObj.dataBind();
5439
5438
  this.setMultiSelect();
5440
5439
  }
@@ -5900,7 +5899,7 @@ let DropDownTree = class DropDownTree extends Component {
5900
5899
  }
5901
5900
  const eventArgs = {
5902
5901
  action: this.showCheckBox ? state : args.action,
5903
- isInteracted: args.isInteracted,
5902
+ isInteracted: this.isClicked ? true : args.isInteracted,
5904
5903
  item: args.node,
5905
5904
  itemData: this.showCheckBox ? checkData[0] : selectData
5906
5905
  };
@@ -5971,6 +5970,7 @@ let DropDownTree = class DropDownTree extends Component {
5971
5970
  }
5972
5971
  const target = args.event.target;
5973
5972
  if ((target.classList.contains('e-fullrow') || target.classList.contains('e-list-text')) && this.showCheckBox) {
5973
+ this.isClicked = true;
5974
5974
  // eslint-disable-next-line
5975
5975
  const getNodeDetails = this.treeObj.getNode(args.node);
5976
5976
  if (getNodeDetails.isChecked === 'true') {
@@ -5979,6 +5979,7 @@ let DropDownTree = class DropDownTree extends Component {
5979
5979
  else {
5980
5980
  this.treeObj.checkAll([args.node]);
5981
5981
  }
5982
+ this.isClicked = false;
5982
5983
  this.setMultiSelect();
5983
5984
  this.ensurePlaceHolder();
5984
5985
  }
@@ -9366,6 +9367,18 @@ let MultiSelect = class MultiSelect extends DropDownBase {
9366
9367
  }
9367
9368
  this.inputFocus = false;
9368
9369
  this.overAllWrapper.classList.remove(FOCUS);
9370
+ if (this.addTagOnBlur) {
9371
+ const dataChecks = this.getValueByText(this.inputElement.value, this.ignoreCase, this.ignoreAccent);
9372
+ const listLiElement = this.findListElement(this.list, 'li', 'data-value', dataChecks);
9373
+ const className = this.hideSelectedItem ? HIDE_LIST : dropDownBaseClasses.selected;
9374
+ const allowChipAddition = (listLiElement && !listLiElement.classList.contains(className)) ? true : false;
9375
+ if (allowChipAddition) {
9376
+ this.updateListSelection(listLiElement, eve);
9377
+ if (this.mode === 'Delimiter') {
9378
+ this.updateDelimeter(this.delimiterChar);
9379
+ }
9380
+ }
9381
+ }
9369
9382
  this.refreshListItems(null);
9370
9383
  if (this.mode !== 'Box' && this.mode !== 'CheckBox') {
9371
9384
  this.updateDelimView();
@@ -11464,16 +11477,12 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11464
11477
  l10n = new L10n('dropdowns', l10nLocale, this.locale);
11465
11478
  }
11466
11479
  const remainContent = l10n.getConstant('overflowCountTemplate');
11480
+ const totalContent = l10n.getConstant('totalCountTemplate');
11467
11481
  const raminElement = this.createElement('span', {
11468
11482
  className: REMAIN_WRAPPER$1
11469
11483
  });
11470
- const compiledString = compile(remainContent);
11471
- const totalCompiledString = compile(l10n.getConstant('totalCountTemplate'));
11472
- // eslint-disable-next-line
11473
- let remainCompildTemp = compiledString({ 'count': this.value.length }, this, 'overflowCountTemplate', null, !this.isStringTemplate, null, raminElement);
11474
- if (remainCompildTemp && remainCompildTemp.length > 0) {
11475
- raminElement.appendChild(remainCompildTemp[0]);
11476
- }
11484
+ let remainCompildTemp = remainContent.replace('${count}', this.value.length.toString());
11485
+ raminElement.innerText = remainCompildTemp;
11477
11486
  this.viewWrapper.appendChild(raminElement);
11478
11487
  this.renderReactTemplates();
11479
11488
  const remainSize = raminElement.offsetWidth;
@@ -11525,9 +11534,9 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11525
11534
  }
11526
11535
  if (remaining > 0) {
11527
11536
  const totalWidth = overAllContainer - downIconWidth - this.clearIconWidth;
11528
- this.viewWrapper.appendChild(this.updateRemainTemplate(raminElement, this.viewWrapper, remaining, compiledString, totalCompiledString, totalWidth));
11537
+ this.viewWrapper.appendChild(this.updateRemainTemplate(raminElement, this.viewWrapper, remaining, remainContent, totalContent, totalWidth));
11529
11538
  this.updateRemainWidth(this.viewWrapper, totalWidth);
11530
- this.updateRemainingText(raminElement, downIconWidth, remaining, compiledString, totalCompiledString);
11539
+ this.updateRemainingText(raminElement, downIconWidth, remaining, remainContent, totalContent);
11531
11540
  }
11532
11541
  }
11533
11542
  else {
@@ -11547,17 +11556,14 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11547
11556
  viewWrapper.style.width = totalWidth + 'px';
11548
11557
  }
11549
11558
  }
11550
- updateRemainTemplate(raminElement, viewWrapper, remaining, compiledString, totalCompiledString, totalWidth) {
11559
+ updateRemainTemplate(raminElement, viewWrapper, remaining, remainContent, totalContent, totalWidth) {
11551
11560
  if (viewWrapper.firstChild && viewWrapper.firstChild.nodeType === 3 && viewWrapper.firstChild.nodeValue === '') {
11552
11561
  viewWrapper.removeChild(viewWrapper.firstChild);
11553
11562
  }
11554
11563
  raminElement.innerHTML = '';
11555
- // eslint-disable-next-line
11556
- let remainTemp = compiledString({ 'count': remaining }, this, 'overflowCountTemplate', null, !this.isStringTemplate, null, raminElement);
11557
- // eslint-disable-next-line
11558
- let totalTemp = totalCompiledString({ 'count': remaining }, this, 'totalCountTemplate', null, !this.isStringTemplate, null, raminElement);
11559
- raminElement.appendChild((viewWrapper.firstChild && viewWrapper.firstChild.nodeType === 3) ?
11560
- remainTemp && remainTemp[0] : totalTemp && totalTemp[0]);
11564
+ let remainTemp = remainContent.replace('${count}', remaining.toString());
11565
+ let totalTemp = totalContent.replace('${count}', remaining.toString());
11566
+ raminElement.innerText = (viewWrapper.firstChild && viewWrapper.firstChild.nodeType === 3) ? remainTemp : totalTemp;
11561
11567
  if (viewWrapper.firstChild && viewWrapper.firstChild.nodeType === 3) {
11562
11568
  viewWrapper.classList.remove(TOTAL_COUNT_WRAPPER$1);
11563
11569
  }
@@ -11567,7 +11573,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11567
11573
  }
11568
11574
  return raminElement;
11569
11575
  }
11570
- updateRemainingText(raminElement, downIconWidth, remaining, compiledString, totalCompiledString) {
11576
+ updateRemainingText(raminElement, downIconWidth, remaining, remainContent, totalContent) {
11571
11577
  const overAllContainer = this.componentWrapper.offsetWidth -
11572
11578
  parseInt(window.getComputedStyle(this.componentWrapper).paddingLeft, 10) -
11573
11579
  parseInt(window.getComputedStyle(this.componentWrapper).paddingRight, 10);
@@ -11586,7 +11592,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11586
11592
  wrapperleng = this.viewWrapper.offsetWidth;
11587
11593
  }
11588
11594
  const totalWidth = overAllContainer - downIconWidth;
11589
- this.updateRemainTemplate(raminElement, this.viewWrapper, remaining, compiledString, totalCompiledString, totalWidth);
11595
+ this.updateRemainTemplate(raminElement, this.viewWrapper, remaining, remainContent, totalContent, totalWidth);
11590
11596
  }
11591
11597
  }
11592
11598
  getOverflowVal(index) {
@@ -12585,6 +12591,9 @@ __decorate$5([
12585
12591
  __decorate$5([
12586
12592
  Property(true)
12587
12593
  ], MultiSelect.prototype, "openOnClick", void 0);
12594
+ __decorate$5([
12595
+ Property(false)
12596
+ ], MultiSelect.prototype, "addTagOnBlur", void 0);
12588
12597
  __decorate$5([
12589
12598
  Event()
12590
12599
  ], MultiSelect.prototype, "change", void 0);
@@ -12775,7 +12784,7 @@ class CheckBoxSelection {
12775
12784
  }
12776
12785
  if (this.parent.list.classList.contains('e-nodata') || (this.parent.listData && this.parent.listData.length <= 1 &&
12777
12786
  !(this.parent.isDynamicDataChange)) || (this.parent.isDynamicDataChange &&
12778
- !isNullOrUndefined(this.parent.value) && this.parent.value.length <= 1)) {
12787
+ this.parent.listData && this.parent.listData.length <= 1)) {
12779
12788
  this.checkAllParent.style.display = 'none';
12780
12789
  }
12781
12790
  else {