@syncfusion/ej2-dropdowns 20.2.43 → 20.2.44

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.
@@ -463,7 +463,7 @@ let DropDownBase = class DropDownBase extends Component {
463
463
  *
464
464
  * @returns {void}
465
465
  */
466
- initialize() {
466
+ initialize(e) {
467
467
  this.bindEvent = true;
468
468
  this.actionFailureTemplateId = `${this.element.id}${ACTIONFAILURETEMPLATE_PROPERTY}`;
469
469
  if (this.element.tagName === 'UL') {
@@ -482,7 +482,7 @@ let DropDownBase = class DropDownBase extends Component {
482
482
  }
483
483
  }
484
484
  else {
485
- this.setListData(this.dataSource, this.fields, this.query);
485
+ this.setListData(this.dataSource, this.fields, this.query, e);
486
486
  }
487
487
  }
488
488
  /**
@@ -589,7 +589,7 @@ let DropDownBase = class DropDownBase extends Component {
589
589
  * @param {Query} query - Accepts the external Query that execute along with data processing.
590
590
  * @returns {void}
591
591
  */
592
- setListData(dataSource, fields, query) {
592
+ setListData(dataSource, fields, query, event) {
593
593
  fields = fields ? fields : this.fields;
594
594
  let ulElement;
595
595
  this.isActive = true;
@@ -635,7 +635,7 @@ let DropDownBase = class DropDownBase extends Component {
635
635
  this.trigger('actionComplete', localDataArgs, (localDataArgs) => {
636
636
  if (!localDataArgs.cancel) {
637
637
  ulElement = this.renderItems(localDataArgs.result, fields);
638
- this.onActionComplete(ulElement, localDataArgs.result);
638
+ this.onActionComplete(ulElement, localDataArgs.result, event);
639
639
  if (this.groupTemplate) {
640
640
  this.renderGroupTemplate(ulElement);
641
641
  }
@@ -1024,7 +1024,7 @@ let DropDownBase = class DropDownBase extends Component {
1024
1024
  * @param {Query} query - Accepts the external Query that execute along with data processing.
1025
1025
  * @returns {void}
1026
1026
  */
1027
- resetList(dataSource, fields, query) {
1027
+ resetList(dataSource, fields, query, e) {
1028
1028
  if (this.list) {
1029
1029
  if ((this.element.tagName === 'SELECT' && this.element.options.length > 0)
1030
1030
  || (this.element.tagName === 'UL' && this.element.childNodes.length > 0)) {
@@ -1035,7 +1035,7 @@ let DropDownBase = class DropDownBase extends Component {
1035
1035
  }
1036
1036
  }
1037
1037
  dataSource = this.getModuleName() === 'combobox' && this.selectData && dataSource instanceof Array && dataSource.length < this.selectData.length ? this.selectData : dataSource;
1038
- this.setListData(dataSource, fields, query);
1038
+ this.setListData(dataSource, fields, query, e);
1039
1039
  }
1040
1040
  }
1041
1041
  updateSelectElementData(isFiltering) {
@@ -1126,7 +1126,7 @@ let DropDownBase = class DropDownBase extends Component {
1126
1126
  * @private
1127
1127
  * @returns {void}
1128
1128
  */
1129
- render(isEmptyData) {
1129
+ render(e, isEmptyData) {
1130
1130
  this.list = this.createElement('div', { className: dropDownBaseClasses.content, attrs: { 'tabindex': '0' } });
1131
1131
  this.list.classList.add(dropDownBaseClasses.root);
1132
1132
  this.setFields();
@@ -1150,7 +1150,7 @@ let DropDownBase = class DropDownBase extends Component {
1150
1150
  this.setEnableRtl();
1151
1151
  this.setEnabled();
1152
1152
  if (!isEmptyData) {
1153
- this.initialize();
1153
+ this.initialize(e);
1154
1154
  }
1155
1155
  }
1156
1156
  /**
@@ -1567,8 +1567,8 @@ let DropDownList = class DropDownList extends DropDownBase {
1567
1567
  this.popupObj.setProperties({ 'zIndex': this.zIndex });
1568
1568
  }
1569
1569
  }
1570
- renderList(isEmptyData) {
1571
- super.render(isEmptyData);
1570
+ renderList(e, isEmptyData) {
1571
+ super.render(e, isEmptyData);
1572
1572
  this.unWireListEvents();
1573
1573
  this.wireListEvents();
1574
1574
  }
@@ -2051,7 +2051,7 @@ let DropDownList = class DropDownList extends DropDownBase {
2051
2051
  const isTabAction = e.action === 'tab' || e.action === 'close';
2052
2052
  if (this.list === undefined && !this.isRequested && !isTabAction && e.action !== 'escape') {
2053
2053
  this.searchKeyEvent = e;
2054
- this.renderList();
2054
+ this.renderList(e);
2055
2055
  }
2056
2056
  if (isNullOrUndefined(this.list) || (!isNullOrUndefined(this.liCollections) &&
2057
2057
  isNavigation && this.liCollections.length === 0) || this.isRequested) {
@@ -2090,7 +2090,7 @@ let DropDownList = class DropDownList extends DropDownBase {
2090
2090
  }
2091
2091
  break;
2092
2092
  case 'open':
2093
- this.showPopup();
2093
+ this.showPopup(e);
2094
2094
  break;
2095
2095
  case 'hide':
2096
2096
  this.preventAltUp = this.isPopupOpen;
@@ -2282,7 +2282,7 @@ let DropDownList = class DropDownList extends DropDownBase {
2282
2282
  }
2283
2283
  if (!this.readonly) {
2284
2284
  if (this.isPopupOpen) {
2285
- this.hidePopup();
2285
+ this.hidePopup(e);
2286
2286
  if (this.isFilterLayout()) {
2287
2287
  this.focusDropDown(e);
2288
2288
  }
@@ -2292,7 +2292,7 @@ let DropDownList = class DropDownList extends DropDownBase {
2292
2292
  this.floatLabelChange();
2293
2293
  this.queryString = this.inputElement.value.trim() === '' ? null : this.inputElement.value;
2294
2294
  this.isDropDownClick = true;
2295
- this.showPopup();
2295
+ this.showPopup(e);
2296
2296
  }
2297
2297
  // eslint-disable-next-line @typescript-eslint/no-this-alias
2298
2298
  const proxy = this;
@@ -2933,26 +2933,8 @@ let DropDownList = class DropDownList extends DropDownBase {
2933
2933
  }
2934
2934
  this.initial = false;
2935
2935
  }
2936
- else if (this.getModuleName() === 'autocomplete' && this.value && this.typedString === '' && !(this.dataSource instanceof DataManager)) {
2937
- const checkFields = this.typeOfData(this.dataSource).typeof === 'string' ? '' : this.fields.value;
2938
- const checkValue = list.some((x) => x[checkFields] === this.value);
2939
- let query = new Query();
2940
- if (!checkValue) {
2941
- new DataManager(this.dataSource).executeQuery(query.where(new Predicate(checkFields, 'equal', this.value)))
2942
- .then((e) => {
2943
- if (e.result.length > 0) {
2944
- this.value = checkFields !== '' ? e.result[0][this.fields.value].toString() : e.result[0].toString();
2945
- this.addItem(e.result, list.length);
2946
- this.updateValues();
2947
- }
2948
- else {
2949
- this.updateValues();
2950
- }
2951
- });
2952
- }
2953
- else {
2954
- this.updateValues();
2955
- }
2936
+ else if (this.getModuleName() === 'autocomplete' && this.value) {
2937
+ this.setInputValue();
2956
2938
  }
2957
2939
  if (this.getModuleName() !== 'autocomplete' && this.isFiltering() && !this.isTyped) {
2958
2940
  if (!this.actionCompleteData.isUpdated || ((!this.isCustomFilter
@@ -2975,7 +2957,7 @@ let DropDownList = class DropDownList extends DropDownBase {
2975
2957
  }
2976
2958
  }
2977
2959
  if (this.beforePopupOpen) {
2978
- this.renderPopup();
2960
+ this.renderPopup(e);
2979
2961
  }
2980
2962
  }
2981
2963
  }
@@ -3045,7 +3027,7 @@ let DropDownList = class DropDownList extends DropDownBase {
3045
3027
  removeClass(highlightedItem, dropDownListClasses.focus);
3046
3028
  }
3047
3029
  }
3048
- renderPopup() {
3030
+ renderPopup(e) {
3049
3031
  if (this.popupObj && document.body.contains(this.popupObj.element)) {
3050
3032
  this.refreshPopup();
3051
3033
  return;
@@ -3146,7 +3128,7 @@ let DropDownList = class DropDownList extends DropDownBase {
3146
3128
  const animModel = { name: 'FadeIn', duration: 100 };
3147
3129
  this.beforePopupOpen = true;
3148
3130
  const popupInstance = this.popupObj;
3149
- const eventArgs = { popup: popupInstance, cancel: false, animation: animModel };
3131
+ const eventArgs = { popup: popupInstance, event: e, cancel: false, animation: animModel };
3150
3132
  this.trigger('open', eventArgs, (eventArgs) => {
3151
3133
  if (!eventArgs.cancel) {
3152
3134
  addClass([this.inputWrapper.container], [dropDownListClasses.iconAnimation]);
@@ -3556,7 +3538,12 @@ let DropDownList = class DropDownList extends DropDownBase {
3556
3538
  setFooterTemplate(popupEle) {
3557
3539
  let compiledString;
3558
3540
  if (this.footer) {
3559
- this.footer.innerHTML = '';
3541
+ if (this.isReact) {
3542
+ this.clearTemplate(['footerTemplate']);
3543
+ }
3544
+ else {
3545
+ this.footer.innerHTML = '';
3546
+ }
3560
3547
  }
3561
3548
  else {
3562
3549
  this.footer = this.createElement('div');
@@ -3747,6 +3734,9 @@ let DropDownList = class DropDownList extends DropDownBase {
3747
3734
  }
3748
3735
  });
3749
3736
  }
3737
+ else if (this.getModuleName() === 'autocomplete') {
3738
+ this.setInputValue(newProp, oldProp);
3739
+ }
3750
3740
  else {
3751
3741
  this.setOldText(oldProp.text);
3752
3742
  }
@@ -3788,6 +3778,9 @@ let DropDownList = class DropDownList extends DropDownBase {
3788
3778
  }
3789
3779
  });
3790
3780
  }
3781
+ else if (this.getModuleName() === 'autocomplete') {
3782
+ this.setInputValue(newProp, oldProp);
3783
+ }
3791
3784
  else {
3792
3785
  this.setOldValue(oldProp.value);
3793
3786
  }
@@ -3900,6 +3893,8 @@ let DropDownList = class DropDownList extends DropDownBase {
3900
3893
  removeClass([this.inputWrapper.container], ['e-readonly']);
3901
3894
  }
3902
3895
  }
3896
+ setInputValue(newProp, oldProp) {
3897
+ }
3903
3898
  setCssClass(newClass, oldClass) {
3904
3899
  if (!isNullOrUndefined(oldClass)) {
3905
3900
  oldClass = (oldClass.replace(/\s+/g, ' ')).trim();
@@ -3926,7 +3921,7 @@ let DropDownList = class DropDownList extends DropDownBase {
3926
3921
  *
3927
3922
  * @returns {void}
3928
3923
  */
3929
- showPopup() {
3924
+ showPopup(e) {
3930
3925
  if (!this.enabled) {
3931
3926
  return;
3932
3927
  }
@@ -3946,11 +3941,11 @@ let DropDownList = class DropDownList extends DropDownBase {
3946
3941
  }
3947
3942
  else if (isNullOrUndefined(this.list) || !isUndefined(this.list) && (this.list.classList.contains(dropDownBaseClasses.noData) ||
3948
3943
  this.list.querySelectorAll('.' + dropDownBaseClasses.li).length <= 0)) {
3949
- this.renderList();
3944
+ this.renderList(e);
3950
3945
  }
3951
- this.invokeRenderPopup();
3946
+ this.invokeRenderPopup(e);
3952
3947
  }
3953
- invokeRenderPopup() {
3948
+ invokeRenderPopup(e) {
3954
3949
  if (Browser.isDevice && this.isFilterLayout()) {
3955
3950
  // eslint-disable-next-line @typescript-eslint/no-this-alias
3956
3951
  const proxy = this;
@@ -3960,7 +3955,7 @@ let DropDownList = class DropDownList extends DropDownBase {
3960
3955
  history.pushState({}, '');
3961
3956
  }
3962
3957
  if (!isNullOrUndefined(this.list.children[0]) || this.list.classList.contains(dropDownBaseClasses.noData)) {
3963
- this.renderPopup();
3958
+ this.renderPopup(e);
3964
3959
  }
3965
3960
  attributes(this.targetElement(), { 'aria-activedescendant': this.selectedLI ? this.selectedLI.id : null });
3966
3961
  }
@@ -7700,7 +7695,7 @@ let ComboBox = class ComboBox extends DropDownList {
7700
7695
  }
7701
7696
  }
7702
7697
  incrementalSearch(e) {
7703
- this.showPopup();
7698
+ this.showPopup(e);
7704
7699
  if (!isNullOrUndefined(this.listData)) {
7705
7700
  this.inlineSearch(e);
7706
7701
  e.preventDefault();
@@ -7960,8 +7955,8 @@ let ComboBox = class ComboBox extends DropDownList {
7960
7955
  * @returns {void}
7961
7956
  * @deprecated
7962
7957
  */
7963
- showPopup() {
7964
- super.showPopup();
7958
+ showPopup(e) {
7959
+ super.showPopup(e);
7965
7960
  }
7966
7961
  /* eslint-disable valid-jsdoc, jsdoc/require-param */
7967
7962
  /**
@@ -8236,13 +8231,13 @@ let AutoComplete = class AutoComplete extends ComboBox {
8236
8231
  this.isTyped = true;
8237
8232
  this.isDataFetched = this.isSelectCustom = false;
8238
8233
  if (isNullOrUndefined(this.list)) {
8239
- super.renderList(true);
8234
+ super.renderList(e, true);
8240
8235
  }
8241
8236
  this.queryString = this.filterInput.value;
8242
8237
  if (e.type !== 'mousedown' && (e.keyCode === 40 || e.keyCode === 38)) {
8243
8238
  this.queryString = this.queryString === '' ? null : this.queryString;
8244
8239
  this.beforePopupOpen = true;
8245
- this.resetList(this.dataSource, this.fields);
8240
+ this.resetList(this.dataSource, this.fields, null, e);
8246
8241
  return;
8247
8242
  }
8248
8243
  this.isSelected = false;
@@ -8262,7 +8257,7 @@ let AutoComplete = class AutoComplete extends ComboBox {
8262
8257
  this.trigger('filtering', eventArgs, (eventArgs) => {
8263
8258
  if (!eventArgs.cancel && !this.isFiltered && !eventArgs.preventDefaultAction) {
8264
8259
  this.searchList = true;
8265
- this.filterAction(this.dataSource, null, this.fields);
8260
+ this.filterAction(this.dataSource, null, this.fields, e);
8266
8261
  }
8267
8262
  });
8268
8263
  }
@@ -8279,13 +8274,13 @@ let AutoComplete = class AutoComplete extends ComboBox {
8279
8274
  this.isFiltered = true;
8280
8275
  this.filterAction(dataSource, query, fields);
8281
8276
  }
8282
- filterAction(dataSource, query, fields) {
8277
+ filterAction(dataSource, query, fields, e) {
8283
8278
  this.beforePopupOpen = true;
8284
8279
  if (this.queryString !== '' && (this.queryString.length >= this.minLength)) {
8285
- this.resetList(dataSource, fields, query);
8280
+ this.resetList(dataSource, fields, query, e);
8286
8281
  }
8287
8282
  else {
8288
- this.hidePopup();
8283
+ this.hidePopup(e);
8289
8284
  this.beforePopupOpen = false;
8290
8285
  }
8291
8286
  this.renderReactTemplates();
@@ -8371,9 +8366,9 @@ let AutoComplete = class AutoComplete extends ComboBox {
8371
8366
  isFiltering() {
8372
8367
  return true;
8373
8368
  }
8374
- renderPopup() {
8369
+ renderPopup(e) {
8375
8370
  this.list.scrollTop = 0;
8376
- super.renderPopup();
8371
+ super.renderPopup(e);
8377
8372
  }
8378
8373
  isEditTextBox() {
8379
8374
  return true && this.inputElement.value.trim() !== '';
@@ -8385,13 +8380,37 @@ let AutoComplete = class AutoComplete extends ComboBox {
8385
8380
  isSelectFocusItem(element) {
8386
8381
  return false;
8387
8382
  }
8383
+ setInputValue(newProp, oldProp) {
8384
+ let oldValue = oldProp && oldProp.text ? oldProp.text : oldProp ? oldProp.value : oldProp;
8385
+ let value = newProp && newProp.text ? newProp.text : newProp && newProp.value ? newProp.value : this.value;
8386
+ if (value && this.typedString === '' && !this.allowCustom && !(this.dataSource instanceof DataManager)) {
8387
+ let checkFields_1 = this.typeOfData(this.dataSource).typeof === 'string' ? '' : this.fields.value;
8388
+ const listLength = this.getItems().length;
8389
+ let query = new Query();
8390
+ let _this = this;
8391
+ new DataManager(this.dataSource).executeQuery(query.where(new Predicate(checkFields_1, 'equal', value)))
8392
+ .then(function (e) {
8393
+ if (e.result.length > 0) {
8394
+ _this.value = checkFields_1 !== '' ? e.result[0][_this.fields.value].toString() : e.result[0].toString();
8395
+ _this.addItem(e.result, listLength);
8396
+ _this.updateValues();
8397
+ }
8398
+ else {
8399
+ newProp && newProp.text ? _this.setOldText(oldValue) : newProp && newProp.value ? _this.setOldValue(oldValue) : _this.updateValues();
8400
+ }
8401
+ });
8402
+ }
8403
+ else if (newProp) {
8404
+ newProp.text ? this.setOldText(oldValue) : this.setOldValue(oldValue);
8405
+ }
8406
+ }
8388
8407
  /**
8389
8408
  * Search the entered text and show it in the suggestion list if available.
8390
8409
  *
8391
8410
  * @returns {void}
8392
8411
  * @deprecated
8393
8412
  */
8394
- showPopup() {
8413
+ showPopup(e) {
8395
8414
  if (!this.enabled) {
8396
8415
  return;
8397
8416
  }
@@ -8402,10 +8421,10 @@ let AutoComplete = class AutoComplete extends ComboBox {
8402
8421
  this.beforePopupOpen = true;
8403
8422
  this.preventAutoFill = true;
8404
8423
  if (isNullOrUndefined(this.list)) {
8405
- this.renderList();
8424
+ this.renderList(e);
8406
8425
  }
8407
8426
  else {
8408
- this.resetList(this.dataSource, this.fields);
8427
+ this.resetList(this.dataSource, this.fields, null, e);
8409
8428
  }
8410
8429
  }
8411
8430
  /**
@@ -8889,7 +8908,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
8889
8908
  }
8890
8909
  }
8891
8910
  }
8892
- onPopupShown() {
8911
+ onPopupShown(e) {
8893
8912
  if (Browser.isDevice && (this.mode === 'CheckBox' && this.allowFiltering)) {
8894
8913
  // eslint-disable-next-line @typescript-eslint/no-this-alias
8895
8914
  const proxy = this;
@@ -8900,7 +8919,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
8900
8919
  history.pushState({}, '');
8901
8920
  }
8902
8921
  const animModel = { name: 'FadeIn', duration: 100 };
8903
- const eventArgs = { popup: this.popupObj, cancel: false, animation: animModel };
8922
+ const eventArgs = { popup: this.popupObj, event: e, cancel: false, animation: animModel };
8904
8923
  this.trigger('open', eventArgs, (eventArgs) => {
8905
8924
  if (!eventArgs.cancel) {
8906
8925
  this.focusAtFirstListItem();
@@ -9124,7 +9143,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
9124
9143
  this.renderPopup();
9125
9144
  if (this.beforePopupOpen) {
9126
9145
  this.beforePopupOpen = false;
9127
- this.onPopupShown();
9146
+ this.onPopupShown(e);
9128
9147
  }
9129
9148
  }
9130
9149
  refreshSelection() {
@@ -9416,7 +9435,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
9416
9435
  }
9417
9436
  if (!this.isPopupOpen() &&
9418
9437
  (this.openOnClick || (this.showDropDownIcon && e.target && e.target.className === dropdownIcon))) {
9419
- this.showPopup();
9438
+ this.showPopup(e);
9420
9439
  }
9421
9440
  else {
9422
9441
  this.hidePopup(e);
@@ -9710,7 +9729,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
9710
9729
  break;
9711
9730
  case 40:
9712
9731
  if (!this.isPopupOpen()) {
9713
- this.showPopup();
9732
+ this.showPopup(e);
9714
9733
  e.preventDefault();
9715
9734
  }
9716
9735
  break;
@@ -10895,7 +10914,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
10895
10914
  this.keyCode = e.keyCode;
10896
10915
  }
10897
10916
  if (!this.isPopupOpen() && this.openOnClick) {
10898
- this.showPopup();
10917
+ this.showPopup(e);
10899
10918
  }
10900
10919
  this.openClick(e);
10901
10920
  if (this.checkTextLength() && !this.allowFiltering && !isNullOrUndefined(e) && (e.keyCode !== 8)) {
@@ -11042,7 +11061,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
11042
11061
  || this.list.querySelector('.e-ul') && this.list.querySelector('.e-ul').childElementCount === 0)) {
11043
11062
  isEmptyData = true;
11044
11063
  }
11045
- super.render(isEmptyData);
11064
+ super.render(null, isEmptyData);
11046
11065
  this.unwireListEvents();
11047
11066
  this.wireListEvents();
11048
11067
  }
@@ -12307,7 +12326,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
12307
12326
  *
12308
12327
  * @returns {void}
12309
12328
  */
12310
- showPopup() {
12329
+ showPopup(e) {
12311
12330
  if (!this.enabled) {
12312
12331
  return;
12313
12332
  }
@@ -12316,7 +12335,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
12316
12335
  if (!args.cancel) {
12317
12336
  if (!this.ulElement) {
12318
12337
  this.beforePopupOpen = true;
12319
- super.render();
12338
+ super.render(e);
12320
12339
  if (this.mode === 'CheckBox' && Browser.isDevice && this.allowFiltering) {
12321
12340
  this.notify('popupFullScreen', { module: 'CheckBoxSelection', enable: this.mode === 'CheckBox' });
12322
12341
  }
@@ -12332,7 +12351,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
12332
12351
  this.beforePopupOpen = false;
12333
12352
  return;
12334
12353
  }
12335
- this.onPopupShown();
12354
+ this.onPopupShown(e);
12336
12355
  }
12337
12356
  });
12338
12357
  }