@syncfusion/ej2-dropdowns 32.2.4 → 32.2.7

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.
@@ -1,4 +1,4 @@
1
- import { EventHandler, Touch, isNullOrUndefined, getValue, select, Browser, debounce, Property, ChildProperty, selectAll, compile, L10n, addClass, removeClass, extend, append, setStyleAttribute, prepend, rippleEffect, detach, Complex, Event, NotifyPropertyChanges, Component, classList, closest, KeyboardEvents, attributes, isUndefined, formatUnit, Animation, getUniqueID, remove, SanitizeHtmlHelper, setValue, matches as matches$1, createElement, getComponent } from '@syncfusion/ej2-base';
1
+ import { EventHandler, Touch, isNullOrUndefined, getValue, select, Browser, debounce, Property, ChildProperty, selectAll, compile, L10n, addClass, removeClass, extend, append, setStyleAttribute, prepend, rippleEffect, detach, Complex, Event, NotifyPropertyChanges, Component, classList, closest, KeyboardEvents, attributes, isUndefined, formatUnit, Animation, getUniqueID, remove, setValue, matches as matches$1, SanitizeHtmlHelper, createElement, getComponent } from '@syncfusion/ej2-base';
2
2
  import { DataManager, Query, DataUtil, Predicate, JsonAdaptor } from '@syncfusion/ej2-data';
3
3
  import { ListBase, Sortable, cssClass, moveTo } from '@syncfusion/ej2-lists';
4
4
  import { Skeleton } from '@syncfusion/ej2-notifications';
@@ -3743,7 +3743,8 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3743
3743
  EventHandler.add(this.inputWrapper.container, 'mousedown', this.dropDownClick, this);
3744
3744
  EventHandler.add(this.inputWrapper.container, 'focus', this.focusIn, this);
3745
3745
  EventHandler.add(this.inputWrapper.container, 'keypress', this.onSearch, this);
3746
- EventHandler.add(window, 'resize', this.windowResize, this);
3746
+ this.resizeHandler = this.windowResize.bind(this);
3747
+ window.addEventListener('resize', this.resizeHandler);
3747
3748
  this.bindCommonEvent();
3748
3749
  };
3749
3750
  DropDownList.prototype.bindCommonEvent = function () {
@@ -4533,7 +4534,10 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
4533
4534
  EventHandler.remove(this.inputWrapper.container, 'mousedown', this.dropDownClick);
4534
4535
  EventHandler.remove(this.inputWrapper.container, 'keypress', this.onSearch);
4535
4536
  EventHandler.remove(this.inputWrapper.container, 'focus', this.focusIn);
4536
- EventHandler.remove(window, 'resize', this.windowResize);
4537
+ if (this.resizeHandler) {
4538
+ window.removeEventListener('resize', this.resizeHandler);
4539
+ this.resizeHandler = null;
4540
+ }
4537
4541
  }
4538
4542
  this.unBindCommonEvent();
4539
4543
  };
@@ -8922,12 +8926,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
8922
8926
  temp = this.getOverflowVal(index);
8923
8927
  data += temp;
8924
8928
  temp = this.overFlowWrapper.innerHTML;
8925
- if (this.enableHtmlSanitizer) {
8926
- this.overFlowWrapper.innerText = SanitizeHtmlHelper.sanitize(data);
8927
- }
8928
- else {
8929
- this.overFlowWrapper.innerHTML = data;
8930
- }
8929
+ this.overFlowWrapper[this.getDomSetter()] = this.getSanitizedText(data);
8931
8930
  wrapperleng = this.overFlowWrapper.offsetWidth;
8932
8931
  overAllContainer = this.inputWrapper.offsetWidth;
8933
8932
  if ((wrapperleng + downIconWidth + this.clearIconWidth) > overAllContainer) {
@@ -9507,6 +9506,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
9507
9506
  dataBound: this.OnDataBound.bind(this),
9508
9507
  allowMultiSelection: this.allowMultiSelection,
9509
9508
  enableHtmlSanitizer: this.enableHtmlSanitizer,
9509
+ disableHtmlEncode: this.disableHtmlEncode,
9510
9510
  showCheckBox: this.showCheckBox,
9511
9511
  autoCheck: this.treeSettings.autoCheck,
9512
9512
  sortOrder: this.sortOrder,
@@ -10493,12 +10493,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
10493
10493
  });
10494
10494
  var chipContent = this.createElement('span', { className: CHIP_CONTENT });
10495
10495
  var chipClose = this.createElement('span', { className: CHIP_CLOSE + ' ' + ICONS });
10496
- if (this.enableHtmlSanitizer) {
10497
- chipContent.innerText = SanitizeHtmlHelper.sanitize(text);
10498
- }
10499
- else {
10500
- chipContent.innerHTML = text;
10501
- }
10496
+ chipContent[this.getDomSetter()] = this.getSanitizedText(text);
10502
10497
  chip.appendChild(chipContent);
10503
10498
  this.chipCollection.appendChild(chip);
10504
10499
  if (this.showClearButton) {
@@ -10937,6 +10932,12 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
10937
10932
  this.hiddenElement.removeAttribute('multiple');
10938
10933
  }
10939
10934
  };
10935
+ DropDownTree.prototype.getDomSetter = function () {
10936
+ return this.disableHtmlEncode ? 'textContent' : 'innerHTML';
10937
+ };
10938
+ DropDownTree.prototype.getSanitizedText = function (text) {
10939
+ return this.enableHtmlSanitizer ? SanitizeHtmlHelper.sanitize(text) : text;
10940
+ };
10940
10941
  /**
10941
10942
  * Dynamically change the value of properties.
10942
10943
  *
@@ -11406,6 +11407,9 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
11406
11407
  __decorate$2([
11407
11408
  Property(true)
11408
11409
  ], DropDownTree.prototype, "enableHtmlSanitizer", void 0);
11410
+ __decorate$2([
11411
+ Property(true)
11412
+ ], DropDownTree.prototype, "disableHtmlEncode", void 0);
11409
11413
  __decorate$2([
11410
11414
  Property(true)
11411
11415
  ], DropDownTree.prototype, "showClearButton", void 0);
@@ -16868,7 +16872,8 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16868
16872
  };
16869
16873
  MultiSelect.prototype.wireEvent = function () {
16870
16874
  EventHandler.add(this.componentWrapper, 'mousedown', this.wrapperClick, this);
16871
- EventHandler.add(window, 'resize', this.windowResize, this);
16875
+ this.resizeHandler = this.windowResize.bind(this);
16876
+ window.addEventListener('resize', this.resizeHandler);
16872
16877
  EventHandler.add(this.inputElement, 'focus', this.focusInHandler, this);
16873
16878
  EventHandler.add(this.inputElement, 'keydown', this.onKeyDown, this);
16874
16879
  EventHandler.add(this.inputElement, 'keyup', this.keyUp, this);
@@ -18179,7 +18184,10 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
18179
18184
  if (!isNullOrUndefined(this.componentWrapper)) {
18180
18185
  EventHandler.remove(this.componentWrapper, 'mousedown', this.wrapperClick);
18181
18186
  }
18182
- EventHandler.remove(window, 'resize', this.windowResize);
18187
+ if (this.resizeHandler) {
18188
+ window.removeEventListener('resize', this.resizeHandler);
18189
+ this.resizeHandler = null;
18190
+ }
18183
18191
  if (!isNullOrUndefined(this.inputElement)) {
18184
18192
  EventHandler.remove(this.inputElement, 'focus', this.focusInHandler);
18185
18193
  EventHandler.remove(this.inputElement, 'keydown', this.onKeyDown);
@@ -21936,7 +21944,8 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
21936
21944
  if (form) {
21937
21945
  EventHandler.add(form, 'reset', this.formResetHandler, this);
21938
21946
  }
21939
- window.addEventListener('resize', this.resizeHandler.bind(this));
21947
+ this.boundResizeHandler = this.resizeHandler.bind(this);
21948
+ window.addEventListener('resize', this.boundResizeHandler);
21940
21949
  };
21941
21950
  ListBox.prototype.wireToolbarEvent = function () {
21942
21951
  if (this.toolbarSettings.items.length) {
@@ -21958,7 +21967,10 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
21958
21967
  if (form) {
21959
21968
  EventHandler.remove(form, 'reset', this.formResetHandler);
21960
21969
  }
21961
- window.removeEventListener('resize', this.resizeHandler.bind(this));
21970
+ if (this.boundResizeHandler) {
21971
+ window.removeEventListener('resize', this.boundResizeHandler);
21972
+ this.boundResizeHandler = null;
21973
+ }
21962
21974
  };
21963
21975
  ListBox.prototype.clickHandler = function (e) {
21964
21976
  var li = closest(e.target, '.' + 'e-list-item');
@@ -23578,16 +23590,21 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
23578
23590
  this.wireEvent();
23579
23591
  };
23580
23592
  Mention.prototype.wireEvent = function () {
23581
- EventHandler.add(this.inputElement, 'keyup', this.onKeyUp, this);
23593
+ this.keyupHandler = this.onKeyUp.bind(this);
23594
+ EventHandler.add(this.inputElement, 'keyup', this.keyupHandler, this);
23582
23595
  this.bindCommonEvent();
23583
23596
  };
23584
23597
  Mention.prototype.unWireEvent = function () {
23585
- EventHandler.remove(this.inputElement, 'keyup', this.onKeyUp);
23598
+ if (this.keyupHandler) {
23599
+ EventHandler.remove(this.inputElement, 'keyup', this.keyupHandler);
23600
+ this.keyupHandler = null;
23601
+ }
23586
23602
  this.unBindCommonEvent();
23587
23603
  };
23588
23604
  Mention.prototype.bindCommonEvent = function () {
23589
23605
  if (!Browser.isDevice) {
23590
- this.inputElement.addEventListener('keydown', this.keyDownHandler.bind(this), !this.isRTE);
23606
+ this.keydownHandler = this.keyDownHandler.bind(this);
23607
+ this.inputElement.addEventListener('keydown', this.keydownHandler, !this.isRTE);
23591
23608
  }
23592
23609
  };
23593
23610
  /**
@@ -23776,8 +23793,9 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
23776
23793
  return !isNullOrUndefined(element);
23777
23794
  };
23778
23795
  Mention.prototype.unBindCommonEvent = function () {
23779
- if (!Browser.isDevice) {
23780
- this.inputElement.removeEventListener('keydown', this.keyDownHandler.bind(this), !this.isRTE);
23796
+ if (!Browser.isDevice && this.keydownHandler) {
23797
+ this.inputElement.removeEventListener('keydown', this.keydownHandler, !this.isRTE);
23798
+ this.keydownHandler = null;
23781
23799
  }
23782
23800
  };
23783
23801
  Mention.prototype.onKeyUp = function (e) {
@@ -24260,9 +24278,11 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
24260
24278
  addClass([popupEle_1], 'e-rte-elements');
24261
24279
  }
24262
24280
  }
24281
+ var appendToElement = _this.getAppendToElement();
24282
+ _this.popupAppendTo = appendToElement;
24263
24283
  if ((!_this.popupObj || !document.body.contains(_this.popupObj.element)) ||
24264
24284
  !document.contains(popupEle_1) && isNullOrUndefined(_this.target)) {
24265
- document.body.appendChild(popupEle_1);
24285
+ appendToElement.appendChild(popupEle_1);
24266
24286
  }
24267
24287
  var coordinates_1;
24268
24288
  popupEle_1.style.visibility = 'hidden';
@@ -24335,6 +24355,19 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
24335
24355
  }
24336
24356
  });
24337
24357
  };
24358
+ Mention.prototype.getAppendToElement = function () {
24359
+ if (this.popupAppendTo) {
24360
+ return this.popupAppendTo;
24361
+ }
24362
+ if (this.isAngular) {
24363
+ var cdkPane = this.element && this.element.closest ? this.element.closest('.cdk-overlay-pane') : null;
24364
+ var popoverEl = this.element && this.element.closest ? this.element.closest('[popover]') : null;
24365
+ if (cdkPane && popoverEl) {
24366
+ return cdkPane;
24367
+ }
24368
+ }
24369
+ return document.body;
24370
+ };
24338
24371
  Mention.prototype.setHeight = function (popupEle) {
24339
24372
  if (this.popupHeight !== 'auto' && this.list) {
24340
24373
  this.list.style.maxHeight = (parseInt(this.listHeight, 10) - 2).toString() + 'px'; // due to box-sizing property