@syncfusion/ej2-dropdowns 21.2.5 → 21.2.8

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.
@@ -99,7 +99,7 @@ function Search(inputVal, items, searchType, ignoreCase, dataSource, fields, typ
99
99
  dataSource.filter(function (data) {
100
100
  Array.prototype.slice.call(fieldValue_1).forEach(function (value) {
101
101
  /* eslint-disable security/detect-object-injection */
102
- if (type === 'object' && checkField_1.textContent.toString().indexOf(data[value]) !== -1 && checkField_1.getAttribute('data-value') === data[fields.value].toString() || type === 'string' && checkField_1.textContent.toString().indexOf(data) !== -1) {
102
+ if (type === 'object' && (!data.isHeader && checkField_1.textContent.toString().indexOf(data[value]) !== -1) && checkField_1.getAttribute('data-value') === data[fields.value].toString() || type === 'string' && checkField_1.textContent.toString().indexOf(data) !== -1) {
103
103
  filterValue = type === 'object' ? data[value] : data;
104
104
  }
105
105
  });
@@ -2656,6 +2656,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
2656
2656
  var index = this.isSelectCustom ? null : this.activeIndex;
2657
2657
  this.setProperties({ 'index': index, 'text': dataItem.text, 'value': dataItem.value }, true);
2658
2658
  this.detachChangeEvent(eve);
2659
+ this.dispatchEvent(this.hiddenElement, 'change');
2659
2660
  };
2660
2661
  DropDownList.prototype.detachChanges = function (value) {
2661
2662
  var items;
@@ -3336,14 +3337,12 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3336
3337
  _this.isNotSearchList = false;
3337
3338
  _this.isDocumentClick = false;
3338
3339
  _this.destroyPopup();
3339
- EventHandler.remove(document, 'mousedown', _this.onDocumentClick);
3340
3340
  if (_this.isFiltering() && _this.actionCompleteData.list && _this.actionCompleteData.list[0]) {
3341
3341
  _this.isActive = true;
3342
3342
  _this.onActionComplete(_this.actionCompleteData.ulElement, _this.actionCompleteData.list, null, true);
3343
3343
  }
3344
3344
  },
3345
3345
  open: function () {
3346
- EventHandler.remove(document, 'mousedown', _this.onDocumentClick);
3347
3346
  EventHandler.add(document, 'mousedown', _this.onDocumentClick, _this);
3348
3347
  _this.isPopupOpen = true;
3349
3348
  var actionList = _this.actionCompleteData && _this.actionCompleteData.ulElement &&
@@ -3523,9 +3522,10 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3523
3522
  DropDownList.prototype.closePopup = function (delay, e) {
3524
3523
  var _this = this;
3525
3524
  this.isTyped = false;
3526
- if (!(this.popupObj && document.body.contains(this.popupObj.element) && (this.beforePopupOpen || this.isEventCancel))) {
3525
+ if (!(this.popupObj && document.body.contains(this.popupObj.element) && this.beforePopupOpen)) {
3527
3526
  return;
3528
3527
  }
3528
+ EventHandler.remove(document, 'mousedown', this.onDocumentClick);
3529
3529
  this.isActive = false;
3530
3530
  this.filterInputObj = null;
3531
3531
  this.isDropDownClick = false;
@@ -3575,7 +3575,6 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3575
3575
  var popupInstance = this.popupObj;
3576
3576
  var eventArgs = { popup: popupInstance, cancel: false, animation: animModel, event: e || null };
3577
3577
  this.trigger('close', eventArgs, function (eventArgs) {
3578
- _this.isEventCancel = eventArgs.cancel;
3579
3578
  if (!isNullOrUndefined(_this.popupObj) &&
3580
3579
  !isNullOrUndefined(_this.popupObj.element.querySelector('.e-fixed-head'))) {
3581
3580
  var fixedHeader = _this.popupObj.element.querySelector('.e-fixed-head');
@@ -3752,9 +3751,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3752
3751
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3753
3752
  var footerCompTemp = compiledString({}, this, 'footerTemplate', this.footerTemplateId, this.isStringTemplate, null, this.footer);
3754
3753
  if (footerCompTemp && footerCompTemp.length > 0) {
3755
- for (var i = 0; i < footerCompTemp.length; i++) {
3756
- this.footer.appendChild(footerCompTemp[i]);
3757
- }
3754
+ append(footerCompTemp, this.footer);
3758
3755
  }
3759
3756
  append([this.footer], popupEle);
3760
3757
  };
@@ -3777,9 +3774,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3777
3774
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3778
3775
  var headerCompTemp = compiledString({}, this, 'headerTemplate', this.headerTemplateId, this.isStringTemplate, null, this.header);
3779
3776
  if (headerCompTemp && headerCompTemp.length) {
3780
- for (var i = 0; i < headerCompTemp.length; i++) {
3781
- this.header.appendChild(headerCompTemp[i]);
3782
- }
3777
+ append(headerCompTemp, this.header);
3783
3778
  }
3784
3779
  var contentEle = popupEle.querySelector('div.e-content');
3785
3780
  popupEle.insertBefore(this.header, contentEle);
@@ -10947,10 +10942,10 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
10947
10942
  }
10948
10943
  };
10949
10944
  MultiSelect.prototype.removeChipFocus = function () {
10950
- var elements = this.chipCollectionWrapper.querySelectorAll('span.' + CHIP$1);
10951
- var closeElements = this.chipCollectionWrapper.querySelectorAll('span.' + CHIP_CLOSE$1.split(' ')[0]);
10945
+ var elements = this.chipCollectionWrapper.querySelectorAll('span.' + CHIP$1 + '.' + CHIP_SELECTED);
10952
10946
  removeClass(elements, CHIP_SELECTED);
10953
10947
  if (Browser.isDevice) {
10948
+ var closeElements = this.chipCollectionWrapper.querySelectorAll('span.' + CHIP_CLOSE$1.split(' ')[0]);
10954
10949
  for (var index = 0; index < closeElements.length; index++) {
10955
10950
  closeElements[index].style.display = 'none';
10956
10951
  }
@@ -11211,9 +11206,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
11211
11206
  // eslint-disable-next-line
11212
11207
  var elements = compiledString({}, this, 'headerTemplate', this.headerTemplateId, this.isStringTemplate, null, this.header);
11213
11208
  if (elements && elements.length > 0) {
11214
- for (var temp = 0; temp < elements.length; temp++) {
11215
- this.header.appendChild(elements[temp]);
11216
- }
11209
+ append(elements, this.header);
11217
11210
  }
11218
11211
  if (this.mode === 'CheckBox' && this.showSelectAll) {
11219
11212
  prepend([this.header], this.popupWrapper);
@@ -11240,9 +11233,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
11240
11233
  // eslint-disable-next-line
11241
11234
  var elements = compiledString({}, this, 'footerTemplate', this.footerTemplateId, this.isStringTemplate, null, this.footer);
11242
11235
  if (elements && elements.length > 0) {
11243
- for (var temp = 0; temp < elements.length; temp++) {
11244
- this.footer.appendChild(elements[temp]);
11245
- }
11236
+ append(elements, this.footer);
11246
11237
  }
11247
11238
  append([this.footer], this.popupWrapper);
11248
11239
  EventHandler.add(this.footer, 'mousedown', this.onListMouseDown, this);
@@ -11459,25 +11450,30 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
11459
11450
  this.hiddenElement.innerHTML = '';
11460
11451
  }
11461
11452
  if (!isNullOrUndefined(this.value)) {
11462
- for (var index = 0; !isNullOrUndefined(this.value[index]); index++) {
11463
- var listValue = this.findListElement(((!isNullOrUndefined(this.mainList)) ? this.mainList : this.ulElement), 'li', 'data-value', this.value[index]);
11453
+ var valueLength = this.value.length;
11454
+ var hiddenElementContent = '';
11455
+ for (var index = 0; index < valueLength; index++) {
11456
+ var valueItem = this.value[index];
11457
+ var listValue = this.findListElement((!isNullOrUndefined(this.mainList) ? this.mainList : this.ulElement), 'li', 'data-value', valueItem);
11464
11458
  if (isNullOrUndefined(listValue) && !this.allowCustomValue) {
11465
11459
  this.value.splice(index, 1);
11466
11460
  index -= 1;
11461
+ valueLength -= 1;
11467
11462
  }
11468
11463
  else {
11469
11464
  if (this.listData) {
11470
- temp = this.getTextByValue(this.value[index]);
11465
+ temp = this.getTextByValue(valueItem);
11471
11466
  }
11472
11467
  else {
11473
- temp = this.value[index];
11468
+ temp = valueItem;
11474
11469
  }
11475
11470
  data += temp + delimiterChar + ' ';
11476
11471
  text.push(temp);
11477
11472
  }
11478
- if (!isNullOrUndefined(this.hiddenElement)) {
11479
- this.hiddenElement.innerHTML += '<option selected value ="' + this.value[index] + '">' + index + '</option>';
11480
- }
11473
+ hiddenElementContent += "<option selected value=\"" + valueItem + "\">" + index + "</option>";
11474
+ }
11475
+ if (!isNullOrUndefined(this.hiddenElement)) {
11476
+ this.hiddenElement.innerHTML = hiddenElementContent;
11481
11477
  }
11482
11478
  }
11483
11479
  this.setProperties({ text: text.toString() }, true);
@@ -14623,6 +14619,16 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
14623
14619
  }
14624
14620
  this.setSelection(items, state, !isValue);
14625
14621
  this.updateSelectedOptions();
14622
+ var selElems = [];
14623
+ for (var i = 0; i < items.length; i++) {
14624
+ var liColl = this.list.querySelectorAll('[aria-selected="true"]');
14625
+ for (var j = 0; j < liColl.length; j++) {
14626
+ if (items[i] === this.getFormattedValue(liColl[j].getAttribute('data-value'))) {
14627
+ selElems.push(liColl[j]);
14628
+ }
14629
+ }
14630
+ }
14631
+ this.triggerChange(selElems, null);
14626
14632
  };
14627
14633
  /**
14628
14634
  * Based on the state parameter, entire list item will be selected/deselected.
@@ -15841,8 +15847,11 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
15841
15847
  }
15842
15848
  if (typeof (text) === 'string') {
15843
15849
  text = text.split('\\').join('\\\\');
15850
+ li = _this.list.querySelector('[data-value="' + text.replace(/"/g, '\\"') + '"]');
15851
+ }
15852
+ else {
15853
+ li = _this.list.querySelector('[data-value="' + text + '"]');
15844
15854
  }
15845
- li = _this.list.querySelector('[data-value="' + text + '"]');
15846
15855
  if (li) {
15847
15856
  if (_this.selectionSettings.showCheckbox) {
15848
15857
  liselect = li.getElementsByClassName('e-frame')[0].classList.contains('e-check');
@@ -15878,9 +15887,12 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
15878
15887
  ele.innerHTML = '';
15879
15888
  if (this.value) {
15880
15889
  for (var i = 0, len = this.value.length; i < len; i++) {
15881
- innerHTML += '<option selected value="' + this.value[i] + '"></option>';
15890
+ innerHTML += '<option selected>' + this.value[i] + '</option>';
15882
15891
  }
15883
15892
  ele.innerHTML += innerHTML;
15893
+ for (var i = 0, len = ele.childNodes.length; i < len; i++) {
15894
+ ele.childNodes[i].setAttribute('value', this.value[i].toString());
15895
+ }
15884
15896
  }
15885
15897
  this.checkSelectAll();
15886
15898
  };
@@ -17096,7 +17108,7 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
17096
17108
  var selectedNodePosition = this.getTriggerCharPosition();
17097
17109
  globalRange = this.range;
17098
17110
  range = document.createRange();
17099
- if (this.getTextRange() && this.getTextRange().lastIndexOf(this.mentionChar) !== -1 && this.isTyped) {
17111
+ if (this.getTextRange() && this.getTextRange().lastIndexOf(this.mentionChar) !== -1) {
17100
17112
  range.setStart(globalRange.startContainer, selectedNodePosition);
17101
17113
  range.setEnd(globalRange.startContainer, selectedNodePosition);
17102
17114
  }