@syncfusion/ej2-dropdowns 21.2.6 → 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.
@@ -3281,7 +3281,6 @@ let DropDownList = class DropDownList extends DropDownBase {
3281
3281
  }
3282
3282
  },
3283
3283
  open: () => {
3284
- EventHandler.remove(document, 'mousedown', this.onDocumentClick);
3285
3284
  EventHandler.add(document, 'mousedown', this.onDocumentClick, this);
3286
3285
  this.isPopupOpen = true;
3287
3286
  const actionList = this.actionCompleteData && this.actionCompleteData.ulElement &&
@@ -3460,9 +3459,10 @@ let DropDownList = class DropDownList extends DropDownBase {
3460
3459
  }
3461
3460
  closePopup(delay, e) {
3462
3461
  this.isTyped = false;
3463
- if (!(this.popupObj && document.body.contains(this.popupObj.element) && (this.beforePopupOpen || this.isEventCancel))) {
3462
+ if (!(this.popupObj && document.body.contains(this.popupObj.element) && this.beforePopupOpen)) {
3464
3463
  return;
3465
3464
  }
3465
+ EventHandler.remove(document, 'mousedown', this.onDocumentClick);
3466
3466
  this.isActive = false;
3467
3467
  this.filterInputObj = null;
3468
3468
  this.isDropDownClick = false;
@@ -3511,7 +3511,6 @@ let DropDownList = class DropDownList extends DropDownBase {
3511
3511
  const popupInstance = this.popupObj;
3512
3512
  const eventArgs = { popup: popupInstance, cancel: false, animation: animModel, event: e || null };
3513
3513
  this.trigger('close', eventArgs, (eventArgs) => {
3514
- this.isEventCancel = eventArgs.cancel;
3515
3514
  if (!isNullOrUndefined(this.popupObj) &&
3516
3515
  !isNullOrUndefined(this.popupObj.element.querySelector('.e-fixed-head'))) {
3517
3516
  const fixedHeader = this.popupObj.element.querySelector('.e-fixed-head');
@@ -3688,9 +3687,7 @@ let DropDownList = class DropDownList extends DropDownBase {
3688
3687
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3689
3688
  const footerCompTemp = compiledString({}, this, 'footerTemplate', this.footerTemplateId, this.isStringTemplate, null, this.footer);
3690
3689
  if (footerCompTemp && footerCompTemp.length > 0) {
3691
- for (let i = 0; i < footerCompTemp.length; i++) {
3692
- this.footer.appendChild(footerCompTemp[i]);
3693
- }
3690
+ append(footerCompTemp, this.footer);
3694
3691
  }
3695
3692
  append([this.footer], popupEle);
3696
3693
  }
@@ -3713,9 +3710,7 @@ let DropDownList = class DropDownList extends DropDownBase {
3713
3710
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3714
3711
  const headerCompTemp = compiledString({}, this, 'headerTemplate', this.headerTemplateId, this.isStringTemplate, null, this.header);
3715
3712
  if (headerCompTemp && headerCompTemp.length) {
3716
- for (let i = 0; i < headerCompTemp.length; i++) {
3717
- this.header.appendChild(headerCompTemp[i]);
3718
- }
3713
+ append(headerCompTemp, this.header);
3719
3714
  }
3720
3715
  const contentEle = popupEle.querySelector('div.e-content');
3721
3716
  popupEle.insertBefore(this.header, contentEle);
@@ -11042,9 +11037,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11042
11037
  // eslint-disable-next-line
11043
11038
  let elements = compiledString({}, this, 'headerTemplate', this.headerTemplateId, this.isStringTemplate, null, this.header);
11044
11039
  if (elements && elements.length > 0) {
11045
- for (let temp = 0; temp < elements.length; temp++) {
11046
- this.header.appendChild(elements[temp]);
11047
- }
11040
+ append(elements, this.header);
11048
11041
  }
11049
11042
  if (this.mode === 'CheckBox' && this.showSelectAll) {
11050
11043
  prepend([this.header], this.popupWrapper);
@@ -11071,9 +11064,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11071
11064
  // eslint-disable-next-line
11072
11065
  let elements = compiledString({}, this, 'footerTemplate', this.footerTemplateId, this.isStringTemplate, null, this.footer);
11073
11066
  if (elements && elements.length > 0) {
11074
- for (let temp = 0; temp < elements.length; temp++) {
11075
- this.footer.appendChild(elements[temp]);
11076
- }
11067
+ append(elements, this.footer);
11077
11068
  }
11078
11069
  append([this.footer], this.popupWrapper);
11079
11070
  EventHandler.add(this.footer, 'mousedown', this.onListMouseDown, this);
@@ -14410,6 +14401,16 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
14410
14401
  }
14411
14402
  this.setSelection(items, state, !isValue);
14412
14403
  this.updateSelectedOptions();
14404
+ let selElems = [];
14405
+ for (let i = 0; i < items.length; i++) {
14406
+ const liColl = this.list.querySelectorAll('[aria-selected="true"]');
14407
+ for (let j = 0; j < liColl.length; j++) {
14408
+ if (items[i] === this.getFormattedValue(liColl[j].getAttribute('data-value'))) {
14409
+ selElems.push(liColl[j]);
14410
+ }
14411
+ }
14412
+ }
14413
+ this.triggerChange(selElems, null);
14413
14414
  }
14414
14415
  /**
14415
14416
  * Based on the state parameter, entire list item will be selected/deselected.
@@ -15604,8 +15605,11 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
15604
15605
  }
15605
15606
  if (typeof (text) === 'string') {
15606
15607
  text = text.split('\\').join('\\\\');
15608
+ li = this.list.querySelector('[data-value="' + text.replace(/"/g, '\\"') + '"]');
15609
+ }
15610
+ else {
15611
+ li = this.list.querySelector('[data-value="' + text + '"]');
15607
15612
  }
15608
- li = this.list.querySelector('[data-value="' + text + '"]');
15609
15613
  if (li) {
15610
15614
  if (this.selectionSettings.showCheckbox) {
15611
15615
  liselect = li.getElementsByClassName('e-frame')[0].classList.contains('e-check');
@@ -15641,9 +15645,12 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
15641
15645
  ele.innerHTML = '';
15642
15646
  if (this.value) {
15643
15647
  for (let i = 0, len = this.value.length; i < len; i++) {
15644
- innerHTML += '<option selected value="' + this.value[i] + '"></option>';
15648
+ innerHTML += '<option selected>' + this.value[i] + '</option>';
15645
15649
  }
15646
15650
  ele.innerHTML += innerHTML;
15651
+ for (let i = 0, len = ele.childNodes.length; i < len; i++) {
15652
+ ele.childNodes[i].setAttribute('value', this.value[i].toString());
15653
+ }
15647
15654
  }
15648
15655
  this.checkSelectAll();
15649
15656
  }
@@ -16835,7 +16842,7 @@ let Mention = class Mention extends DropDownBase {
16835
16842
  const selectedNodePosition = this.getTriggerCharPosition();
16836
16843
  globalRange = this.range;
16837
16844
  range = document.createRange();
16838
- if (this.getTextRange() && this.getTextRange().lastIndexOf(this.mentionChar) !== -1 && this.isTyped) {
16845
+ if (this.getTextRange() && this.getTextRange().lastIndexOf(this.mentionChar) !== -1) {
16839
16846
  range.setStart(globalRange.startContainer, selectedNodePosition);
16840
16847
  range.setEnd(globalRange.startContainer, selectedNodePosition);
16841
16848
  }