@syncfusion/ej2-dropdowns 22.1.36 → 22.1.38

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.
@@ -465,7 +465,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
465
465
  else {
466
466
  var l10nLocale = { noRecordsTemplate: 'No records found', actionFailureTemplate: 'Request failed' };
467
467
  var componentLocale = new L10n(this.getLocaleName(), {}, this.locale);
468
- if (componentLocale.getConstant('actionFailureTemplate') !== '') {
468
+ if (componentLocale.getConstant('actionFailureTemplate') !== '' || componentLocale.getConstant('noRecordsTemplate') !== '') {
469
469
  this.l10n = componentLocale;
470
470
  }
471
471
  else {
@@ -2012,6 +2012,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
2012
2012
  EventHandler.add(this.inputWrapper.container, 'mousedown', this.dropDownClick, this);
2013
2013
  EventHandler.add(this.inputWrapper.container, 'focus', this.focusIn, this);
2014
2014
  EventHandler.add(this.inputWrapper.container, 'keypress', this.onSearch, this);
2015
+ EventHandler.add(window, 'resize', this.windowResize, this);
2015
2016
  this.bindCommonEvent();
2016
2017
  };
2017
2018
  DropDownList.prototype.bindCommonEvent = function () {
@@ -2032,6 +2033,11 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
2032
2033
  }
2033
2034
  this.bindClearEvent();
2034
2035
  };
2036
+ DropDownList.prototype.windowResize = function () {
2037
+ if (this.isPopupOpen) {
2038
+ this.popupObj.refreshPosition(this.inputWrapper.container);
2039
+ }
2040
+ };
2035
2041
  DropDownList.prototype.bindClearEvent = function () {
2036
2042
  if (this.showClearButton) {
2037
2043
  EventHandler.add(this.inputWrapper.clearButton, 'mousedown', this.resetHandler, this);
@@ -2357,6 +2363,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
2357
2363
  EventHandler.remove(this.inputWrapper.container, 'mousedown', this.dropDownClick);
2358
2364
  EventHandler.remove(this.inputWrapper.container, 'keypress', this.onSearch);
2359
2365
  EventHandler.remove(this.inputWrapper.container, 'focus', this.focusIn);
2366
+ EventHandler.remove(window, 'resize', this.windowResize);
2360
2367
  }
2361
2368
  this.unBindCommonEvent();
2362
2369
  };
@@ -3206,20 +3213,20 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3206
3213
  var args = { cancel: false };
3207
3214
  this.trigger('beforeOpen', args, function (args) {
3208
3215
  if (!args.cancel) {
3209
- var popupEle = _this.createElement('div', {
3216
+ var popupEle_1 = _this.createElement('div', {
3210
3217
  id: _this.element.id + '_popup', className: 'e-ddl e-popup ' + (_this.cssClass !== null ? _this.cssClass : '')
3211
3218
  });
3212
- var searchBox = _this.setSearchBox(popupEle);
3219
+ var searchBox = _this.setSearchBox(popupEle_1);
3213
3220
  _this.listHeight = formatUnit(_this.popupHeight);
3214
3221
  if (_this.headerTemplate) {
3215
- _this.setHeaderTemplate(popupEle);
3222
+ _this.setHeaderTemplate(popupEle_1);
3216
3223
  }
3217
- append([_this.list], popupEle);
3224
+ append([_this.list], popupEle_1);
3218
3225
  if (_this.footerTemplate) {
3219
- _this.setFooterTemplate(popupEle);
3226
+ _this.setFooterTemplate(popupEle_1);
3220
3227
  }
3221
- document.body.appendChild(popupEle);
3222
- popupEle.style.visibility = 'hidden';
3228
+ document.body.appendChild(popupEle_1);
3229
+ popupEle_1.style.visibility = 'hidden';
3223
3230
  if (_this.popupHeight !== 'auto') {
3224
3231
  _this.searchBoxHeight = 0;
3225
3232
  if (!isNullOrUndefined(searchBox.container)) {
@@ -3227,20 +3234,20 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3227
3234
  _this.listHeight = (parseInt(_this.listHeight, 10) - (_this.searchBoxHeight)).toString() + 'px';
3228
3235
  }
3229
3236
  if (_this.headerTemplate) {
3230
- _this.header = _this.header ? _this.header : popupEle.querySelector('.e-ddl-header');
3237
+ _this.header = _this.header ? _this.header : popupEle_1.querySelector('.e-ddl-header');
3231
3238
  var height = Math.round(_this.header.getBoundingClientRect().height);
3232
3239
  _this.listHeight = (parseInt(_this.listHeight, 10) - (height + _this.searchBoxHeight)).toString() + 'px';
3233
3240
  }
3234
3241
  if (_this.footerTemplate) {
3235
- _this.footer = _this.footer ? _this.footer : popupEle.querySelector('.e-ddl-footer');
3242
+ _this.footer = _this.footer ? _this.footer : popupEle_1.querySelector('.e-ddl-footer');
3236
3243
  var height = Math.round(_this.footer.getBoundingClientRect().height);
3237
3244
  _this.listHeight = (parseInt(_this.listHeight, 10) - (height + _this.searchBoxHeight)).toString() + 'px';
3238
3245
  }
3239
3246
  _this.list.style.maxHeight = (parseInt(_this.listHeight, 10) - 2).toString() + 'px'; // due to box-sizing property
3240
- popupEle.style.maxHeight = formatUnit(_this.popupHeight);
3247
+ popupEle_1.style.maxHeight = formatUnit(_this.popupHeight);
3241
3248
  }
3242
3249
  else {
3243
- popupEle.style.height = 'auto';
3250
+ popupEle_1.style.height = 'auto';
3244
3251
  }
3245
3252
  var offsetValue = 0;
3246
3253
  var left = void 0;
@@ -3252,7 +3259,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3252
3259
  }
3253
3260
  if (Browser.isDevice && (!_this.allowFiltering && (_this.getModuleName() === 'dropdownlist' ||
3254
3261
  (_this.isDropDownClick && _this.getModuleName() === 'combobox')))) {
3255
- offsetValue = _this.getOffsetValue(popupEle);
3262
+ offsetValue = _this.getOffsetValue(popupEle_1);
3256
3263
  var firstItem = _this.isEmptyList() ? _this.list : _this.liCollections[0];
3257
3264
  if (!isNullOrUndefined(_this.inputElement)) {
3258
3265
  left = -(parseInt(getComputedStyle(firstItem).textIndent, 10) -
@@ -3261,8 +3268,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3261
3268
  }
3262
3269
  }
3263
3270
  _this.getFocusElement();
3264
- _this.createPopup(popupEle, offsetValue, left);
3265
- _this.checkCollision(popupEle);
3271
+ _this.createPopup(popupEle_1, offsetValue, left);
3272
+ _this.checkCollision(popupEle_1);
3273
+ var popupLeft_1 = _this.enableRtl ? parseFloat(popupEle_1.style.left) - (_this.ulElement.parentElement.offsetWidth - _this.inputWrapper.container.offsetWidth) : 0;
3266
3274
  if (Browser.isDevice) {
3267
3275
  _this.popupObj.element.classList.add(dropDownListClasses.device);
3268
3276
  if (_this.getModuleName() === 'dropdownlist' || (_this.getModuleName() === 'combobox'
@@ -3282,8 +3290,8 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3282
3290
  EventHandler.add(_this.clearIconElement, 'click', _this.clearText, _this);
3283
3291
  }
3284
3292
  }
3285
- popupEle.style.visibility = 'visible';
3286
- addClass([popupEle], 'e-popup-close');
3293
+ popupEle_1.style.visibility = 'visible';
3294
+ addClass([popupEle_1], 'e-popup-close');
3287
3295
  var scrollParentElements = _this.popupObj.getScrollableParent(_this.inputWrapper.container);
3288
3296
  for (var _i = 0, scrollParentElements_1 = scrollParentElements; _i < scrollParentElements_1.length; _i++) {
3289
3297
  var element = scrollParentElements_1[_i];
@@ -3316,6 +3324,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3316
3324
  _this.beforePopupOpen = false;
3317
3325
  _this.destroyPopup();
3318
3326
  }
3327
+ if (_this.enableRtl && popupLeft_1 > 0) {
3328
+ popupEle_1.style.left = popupLeft_1 + "px";
3329
+ }
3319
3330
  });
3320
3331
  }
3321
3332
  else {
@@ -4341,6 +4352,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
4341
4352
  this.previousSelectedLI = null;
4342
4353
  this.valueTempElement = null;
4343
4354
  this.actionData.ulElement = null;
4355
+ if (this.inputElement && !isNullOrUndefined(this.inputElement.onchange)) {
4356
+ this.inputElement.onchange = null;
4357
+ }
4344
4358
  _super.prototype.destroy.call(this);
4345
4359
  };
4346
4360
  /* eslint-disable valid-jsdoc, jsdoc/require-returns-description */
@@ -4886,6 +4900,12 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
4886
4900
  }
4887
4901
  _this.treeObj.fields = _this.getTreeFields(fields);
4888
4902
  _this.treeObj.dataBind();
4903
+ if (_this.hasTemplate && _this.portals) {
4904
+ _this.portals = [].concat(_this.treeObj.portals);
4905
+ if (_this.isReact) {
4906
+ _this.renderReactTemplates();
4907
+ }
4908
+ }
4889
4909
  }
4890
4910
  });
4891
4911
  };
@@ -7741,6 +7761,7 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
7741
7761
  EventHandler.add(this.inputElement, 'keyup', this.onFilterUp, this);
7742
7762
  EventHandler.add(this.inputElement, 'keydown', this.onFilterDown, this);
7743
7763
  EventHandler.add(this.inputElement, 'paste', this.pasteHandler, this);
7764
+ EventHandler.add(window, 'resize', this.windowResize, this);
7744
7765
  }
7745
7766
  this.bindCommonEvent();
7746
7767
  };
@@ -8095,6 +8116,7 @@ var ComboBox = /** @__PURE__ @class */ (function (_super) {
8095
8116
  EventHandler.remove(this.inputElement, 'keyup', this.onFilterUp);
8096
8117
  EventHandler.remove(this.inputElement, 'keydown', this.onFilterDown);
8097
8118
  EventHandler.remove(this.inputElement, 'paste', this.pasteHandler);
8119
+ EventHandler.remove(window, 'resize', this.windowResize);
8098
8120
  }
8099
8121
  }
8100
8122
  this.unBindCommonEvent();
@@ -9361,6 +9383,9 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
9361
9383
  if (_this.isFirstClick) {
9362
9384
  _this.loadTemplate();
9363
9385
  }
9386
+ if (_this.enableRtl) {
9387
+ _this.popupWrapper.style.visibility = 'hidden';
9388
+ }
9364
9389
  }
9365
9390
  });
9366
9391
  };
@@ -11229,6 +11254,11 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
11229
11254
  },
11230
11255
  open: function () {
11231
11256
  _this.popupObj.resolveCollision();
11257
+ if (_this.enableRtl) {
11258
+ var popupLeft = parseFloat(_this.popupWrapper.style.left) - (_this.popupWrapper.offsetWidth - _this.overAllWrapper.offsetWidth);
11259
+ _this.popupWrapper.style.left = popupLeft > 0 ? popupLeft + "px" : _this.popupWrapper.style.left;
11260
+ _this.popupWrapper.style.visibility = 'hidden';
11261
+ }
11232
11262
  if (!_this.isFirstClick) {
11233
11263
  var ulElement = _this.list.querySelector('ul');
11234
11264
  if (ulElement) {