@syncfusion/ej2-dropdowns 19.4.48 → 19.4.50

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/ej2-dropdowns.umd.min.js +2 -2
  3. package/dist/ej2-dropdowns.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-dropdowns.es2015.js +47 -5
  5. package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
  6. package/dist/es6/ej2-dropdowns.es5.js +124 -77
  7. package/dist/es6/ej2-dropdowns.es5.js.map +1 -1
  8. package/dist/global/ej2-dropdowns.min.js +2 -2
  9. package/dist/global/ej2-dropdowns.min.js.map +1 -1
  10. package/dist/global/index.d.ts +1 -1
  11. package/package.json +8 -8
  12. package/src/drop-down-base/drop-down-base.js +10 -0
  13. package/src/drop-down-list/drop-down-list.js +106 -71
  14. package/src/list-box/list-box.js +4 -3
  15. package/src/multi-select/multi-select.js +1 -0
  16. package/styles/bootstrap-dark.css +2 -1
  17. package/styles/bootstrap.css +2 -1
  18. package/styles/bootstrap4.css +2 -1
  19. package/styles/bootstrap5-dark.css +2 -1
  20. package/styles/bootstrap5.css +2 -1
  21. package/styles/fabric-dark.css +2 -1
  22. package/styles/fabric.css +2 -1
  23. package/styles/highcontrast-light.css +2 -1
  24. package/styles/highcontrast.css +2 -1
  25. package/styles/material-dark.css +2 -1
  26. package/styles/material.css +2 -1
  27. package/styles/multi-select/_layout.scss +2 -1
  28. package/styles/multi-select/bootstrap-dark.css +2 -1
  29. package/styles/multi-select/bootstrap.css +2 -1
  30. package/styles/multi-select/bootstrap4.css +2 -1
  31. package/styles/multi-select/bootstrap5-dark.css +2 -1
  32. package/styles/multi-select/bootstrap5.css +2 -1
  33. package/styles/multi-select/fabric-dark.css +2 -1
  34. package/styles/multi-select/fabric.css +2 -1
  35. package/styles/multi-select/highcontrast-light.css +2 -1
  36. package/styles/multi-select/highcontrast.css +2 -1
  37. package/styles/multi-select/material-dark.css +2 -1
  38. package/styles/multi-select/material.css +2 -1
  39. package/styles/multi-select/tailwind-dark.css +2 -1
  40. package/styles/multi-select/tailwind.css +2 -1
  41. package/styles/tailwind-dark.css +2 -1
  42. package/styles/tailwind.css +2 -1
@@ -234,6 +234,7 @@ var HEADERTEMPLATE_PROPERTY = 'HeaderTemplate';
234
234
  var FOOTERTEMPLATE_PROPERTY = 'FooterTemplate';
235
235
  var NORECORDSTEMPLATE_PROPERTY = 'NoRecordsTemplate';
236
236
  var ACTIONFAILURETEMPLATE_PROPERTY = 'ActionFailureTemplate';
237
+ var HIDE_GROUPLIST = 'e-hide-group-header';
237
238
  /**
238
239
  * DropDownBase component will generate the list items based on given data and act as base class to drop-down related components
239
240
  */
@@ -749,6 +750,15 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
749
750
  }
750
751
  this.list.innerHTML = '';
751
752
  this.fixedHeaderElement = isNullOrUndefined(this.fixedHeaderElement) ? this.fixedHeaderElement : null;
753
+ if (this.getModuleName() === 'multiselect' && this.properties.allowCustomValue && this.fields.groupBy) {
754
+ for (var i = 0; i < ulElement.childElementCount; i++) {
755
+ if (ulElement.children[i].classList.contains('e-list-group-item')) {
756
+ if (isNullOrUndefined(ulElement.children[i].innerHTML) || ulElement.children[i].innerHTML == "") {
757
+ addClass([ulElement.children[i]], HIDE_GROUPLIST);
758
+ }
759
+ }
760
+ }
761
+ }
752
762
  this.list.appendChild(ulElement);
753
763
  this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
754
764
  this.ulElement = this.list.querySelector('ul');
@@ -3682,160 +3692,195 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3682
3692
  * @returns {void}
3683
3693
  */
3684
3694
  DropDownList.prototype.onPropertyChanged = function (newProp, oldProp) {
3695
+ var _this = this;
3685
3696
  if (this.getModuleName() === 'dropdownlist') {
3686
3697
  this.checkData(newProp);
3687
3698
  this.setUpdateInitial(['fields', 'query', 'dataSource'], newProp);
3688
3699
  }
3689
- for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
3690
- var prop = _a[_i];
3700
+ var _loop_1 = function (prop) {
3691
3701
  switch (prop) {
3692
3702
  case 'query':
3693
3703
  case 'dataSource': break;
3694
3704
  case 'htmlAttributes':
3695
- this.setHTMLAttributes();
3705
+ this_1.setHTMLAttributes();
3696
3706
  break;
3697
3707
  case 'width':
3698
- this.setEleWidth(newProp.width);
3708
+ this_1.setEleWidth(newProp.width);
3699
3709
  break;
3700
3710
  case 'placeholder':
3701
- Input.setPlaceholder(newProp.placeholder, this.inputElement);
3711
+ Input.setPlaceholder(newProp.placeholder, this_1.inputElement);
3702
3712
  break;
3703
3713
  case 'filterBarPlaceholder':
3704
- if (this.filterInput) {
3705
- Input.setPlaceholder(newProp.filterBarPlaceholder, this.filterInput);
3714
+ if (this_1.filterInput) {
3715
+ Input.setPlaceholder(newProp.filterBarPlaceholder, this_1.filterInput);
3706
3716
  }
3707
3717
  break;
3708
3718
  case 'readonly':
3709
- if (this.getModuleName() !== 'dropdownlist') {
3710
- Input.setReadonly(newProp.readonly, this.inputElement);
3719
+ if (this_1.getModuleName() !== 'dropdownlist') {
3720
+ Input.setReadonly(newProp.readonly, this_1.inputElement);
3711
3721
  }
3712
- this.setReadOnly();
3722
+ this_1.setReadOnly();
3713
3723
  break;
3714
3724
  case 'cssClass':
3715
- this.setCssClass(newProp.cssClass, oldProp.cssClass);
3725
+ this_1.setCssClass(newProp.cssClass, oldProp.cssClass);
3716
3726
  break;
3717
3727
  case 'enableRtl':
3718
- this.setEnableRtl();
3728
+ this_1.setEnableRtl();
3719
3729
  break;
3720
3730
  case 'enabled':
3721
- this.setEnable();
3731
+ this_1.setEnable();
3722
3732
  break;
3723
3733
  case 'text':
3724
3734
  if (newProp.text === null) {
3725
- this.clearAll();
3735
+ this_1.clearAll();
3726
3736
  break;
3727
3737
  }
3728
- if (!this.list) {
3729
- if (this.dataSource instanceof DataManager) {
3730
- this.initRemoteRender = true;
3738
+ if (!this_1.list) {
3739
+ if (this_1.dataSource instanceof DataManager) {
3740
+ this_1.initRemoteRender = true;
3731
3741
  }
3732
- this.renderList();
3733
- }
3734
- if (!this.initRemoteRender) {
3735
- var li = this.getElementByText(newProp.text);
3736
- if (!this.checkValidLi(li)) {
3737
- if (this.liCollections && this.liCollections.length === 100 &&
3738
- this.getModuleName() === 'autocomplete' && this.listData.length > 100) {
3739
- this.setSelectionData(newProp.text, oldProp.text, 'text');
3742
+ this_1.renderList();
3743
+ }
3744
+ if (!this_1.initRemoteRender) {
3745
+ var li = this_1.getElementByText(newProp.text);
3746
+ if (!this_1.checkValidLi(li)) {
3747
+ if (this_1.liCollections && this_1.liCollections.length === 100 &&
3748
+ this_1.getModuleName() === 'autocomplete' && this_1.listData.length > 100) {
3749
+ this_1.setSelectionData(newProp.text, oldProp.text, 'text');
3750
+ }
3751
+ else if (newProp.text && this_1.dataSource instanceof DataManager) {
3752
+ var listLength_1 = this_1.getItems().length;
3753
+ var checkField = isNullOrUndefined(this_1.fields.text) ? this_1.fields.value : this_1.fields.text;
3754
+ this_1.typedString = '';
3755
+ this_1.dataSource.executeQuery(this_1.getQuery(this_1.query).where(new Predicate(checkField, 'equal', newProp.text)))
3756
+ .then(function (e) {
3757
+ if (e.result.length > 0) {
3758
+ _this.addItem(e.result, listLength_1);
3759
+ _this.updateValues();
3760
+ }
3761
+ else {
3762
+ _this.setOldText(oldProp.text);
3763
+ }
3764
+ });
3740
3765
  }
3741
3766
  else {
3742
- this.setOldText(oldProp.text);
3767
+ this_1.setOldText(oldProp.text);
3743
3768
  }
3744
3769
  }
3745
- this.updateInputFields();
3770
+ this_1.updateInputFields();
3746
3771
  }
3747
3772
  break;
3748
3773
  case 'value':
3749
3774
  if (newProp.value === null) {
3750
- this.clearAll();
3775
+ this_1.clearAll();
3751
3776
  break;
3752
3777
  }
3753
- this.notify('beforeValueChange', { newProp: newProp }); // gird component value type change
3754
- if (!this.list) {
3755
- if (this.dataSource instanceof DataManager) {
3756
- this.initRemoteRender = true;
3778
+ this_1.notify('beforeValueChange', { newProp: newProp }); // gird component value type change
3779
+ if (!this_1.list) {
3780
+ if (this_1.dataSource instanceof DataManager) {
3781
+ this_1.initRemoteRender = true;
3757
3782
  }
3758
- this.renderList();
3759
- }
3760
- if (!this.initRemoteRender) {
3761
- var item = this.getElementByValue(newProp.value);
3762
- if (!this.checkValidLi(item)) {
3763
- if (this.liCollections && this.liCollections.length === 100 &&
3764
- this.getModuleName() === 'autocomplete' && this.listData.length > 100) {
3765
- this.setSelectionData(newProp.value, oldProp.value, 'value');
3783
+ this_1.renderList();
3784
+ }
3785
+ if (!this_1.initRemoteRender) {
3786
+ var item = this_1.getElementByValue(newProp.value);
3787
+ if (!this_1.checkValidLi(item)) {
3788
+ if (this_1.liCollections && this_1.liCollections.length === 100 &&
3789
+ this_1.getModuleName() === 'autocomplete' && this_1.listData.length > 100) {
3790
+ this_1.setSelectionData(newProp.value, oldProp.value, 'value');
3791
+ }
3792
+ else if (newProp.value && this_1.dataSource instanceof DataManager) {
3793
+ var listLength_2 = this_1.getItems().length;
3794
+ var checkField = isNullOrUndefined(this_1.fields.value) ? this_1.fields.text : this_1.fields.value;
3795
+ this_1.typedString = '';
3796
+ this_1.dataSource.executeQuery(this_1.getQuery(this_1.query).where(new Predicate(checkField, 'equal', newProp.value)))
3797
+ .then(function (e) {
3798
+ if (e.result.length > 0) {
3799
+ _this.addItem(e.result, listLength_2);
3800
+ _this.updateValues();
3801
+ }
3802
+ else {
3803
+ _this.setOldValue(oldProp.value);
3804
+ }
3805
+ });
3766
3806
  }
3767
3807
  else {
3768
- this.setOldValue(oldProp.value);
3808
+ this_1.setOldValue(oldProp.value);
3769
3809
  }
3770
3810
  }
3771
- this.updateInputFields();
3772
- this.preventChange = this.isAngular && this.preventChange ? !this.preventChange : this.preventChange;
3811
+ this_1.updateInputFields();
3812
+ this_1.preventChange = this_1.isAngular && this_1.preventChange ? !this_1.preventChange : this_1.preventChange;
3773
3813
  }
3774
3814
  break;
3775
3815
  case 'index':
3776
3816
  if (newProp.index === null) {
3777
- this.clearAll();
3817
+ this_1.clearAll();
3778
3818
  break;
3779
3819
  }
3780
- if (!this.list) {
3781
- if (this.dataSource instanceof DataManager) {
3782
- this.initRemoteRender = true;
3820
+ if (!this_1.list) {
3821
+ if (this_1.dataSource instanceof DataManager) {
3822
+ this_1.initRemoteRender = true;
3783
3823
  }
3784
- this.renderList();
3785
- }
3786
- if (!this.initRemoteRender && this.liCollections) {
3787
- var element = this.liCollections[newProp.index];
3788
- if (!this.checkValidLi(element)) {
3789
- if (this.liCollections && this.liCollections.length === 100 &&
3790
- this.getModuleName() === 'autocomplete' && this.listData.length > 100) {
3791
- this.setSelectionData(newProp.index, oldProp.index, 'index');
3824
+ this_1.renderList();
3825
+ }
3826
+ if (!this_1.initRemoteRender && this_1.liCollections) {
3827
+ var element = this_1.liCollections[newProp.index];
3828
+ if (!this_1.checkValidLi(element)) {
3829
+ if (this_1.liCollections && this_1.liCollections.length === 100 &&
3830
+ this_1.getModuleName() === 'autocomplete' && this_1.listData.length > 100) {
3831
+ this_1.setSelectionData(newProp.index, oldProp.index, 'index');
3792
3832
  }
3793
3833
  else {
3794
- this.index = oldProp.index;
3834
+ this_1.index = oldProp.index;
3795
3835
  }
3796
3836
  }
3797
- this.updateInputFields();
3837
+ this_1.updateInputFields();
3798
3838
  }
3799
3839
  break;
3800
3840
  case 'footerTemplate':
3801
- if (this.popupObj) {
3802
- this.setFooterTemplate(this.popupObj.element);
3841
+ if (this_1.popupObj) {
3842
+ this_1.setFooterTemplate(this_1.popupObj.element);
3803
3843
  }
3804
3844
  break;
3805
3845
  case 'headerTemplate':
3806
- if (this.popupObj) {
3807
- this.setHeaderTemplate(this.popupObj.element);
3846
+ if (this_1.popupObj) {
3847
+ this_1.setHeaderTemplate(this_1.popupObj.element);
3808
3848
  }
3809
3849
  break;
3810
3850
  case 'valueTemplate':
3811
- if (!isNullOrUndefined(this.itemData) && this.valueTemplate != null) {
3812
- this.setValueTemplate();
3851
+ if (!isNullOrUndefined(this_1.itemData) && this_1.valueTemplate != null) {
3852
+ this_1.setValueTemplate();
3813
3853
  }
3814
3854
  break;
3815
3855
  case 'allowFiltering':
3816
- if (this.allowFiltering) {
3817
- this.actionCompleteData = { ulElement: this.ulElement,
3818
- list: this.listData, isUpdated: true };
3819
- this.actionData = this.actionCompleteData;
3820
- this.updateSelectElementData(this.allowFiltering);
3856
+ if (this_1.allowFiltering) {
3857
+ this_1.actionCompleteData = { ulElement: this_1.ulElement,
3858
+ list: this_1.listData, isUpdated: true };
3859
+ this_1.actionData = this_1.actionCompleteData;
3860
+ this_1.updateSelectElementData(this_1.allowFiltering);
3821
3861
  }
3822
3862
  break;
3823
3863
  case 'floatLabelType':
3824
- Input.removeFloating(this.inputWrapper);
3825
- Input.addFloating(this.inputElement, newProp.floatLabelType, this.placeholder, this.createElement);
3864
+ Input.removeFloating(this_1.inputWrapper);
3865
+ Input.addFloating(this_1.inputElement, newProp.floatLabelType, this_1.placeholder, this_1.createElement);
3826
3866
  break;
3827
3867
  case 'showClearButton':
3828
- Input.setClearButton(newProp.showClearButton, this.inputElement, this.inputWrapper, null, this.createElement);
3829
- this.bindClearEvent();
3868
+ Input.setClearButton(newProp.showClearButton, this_1.inputElement, this_1.inputWrapper, null, this_1.createElement);
3869
+ this_1.bindClearEvent();
3830
3870
  break;
3831
3871
  default:
3832
3872
  {
3833
3873
  // eslint-disable-next-line max-len
3834
- var ddlProps = this.getPropObject(prop, newProp, oldProp);
3835
- _super.prototype.onPropertyChanged.call(this, ddlProps.newProperty, ddlProps.oldProperty);
3874
+ var ddlProps = this_1.getPropObject(prop, newProp, oldProp);
3875
+ _super.prototype.onPropertyChanged.call(this_1, ddlProps.newProperty, ddlProps.oldProperty);
3836
3876
  }
3837
3877
  break;
3838
3878
  }
3879
+ };
3880
+ var this_1 = this;
3881
+ for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
3882
+ var prop = _a[_i];
3883
+ _loop_1(prop);
3839
3884
  }
3840
3885
  };
3841
3886
  DropDownList.prototype.checkValidLi = function (element) {
@@ -12676,6 +12721,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
12676
12721
  this.mainData = null;
12677
12722
  this.filterParent = null;
12678
12723
  this.ulElement = null;
12724
+ this.mainListCollection = null;
12679
12725
  _super.prototype.destroy.call(this);
12680
12726
  var temp = ['readonly', 'aria-disabled', 'aria-placeholder', 'placeholder'];
12681
12727
  var length = temp.length;
@@ -14129,9 +14175,10 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
14129
14175
  }
14130
14176
  if (objValue === dataValue) {
14131
14177
  itemIdx = this.getIndexByValue(dataValue);
14132
- liCollections.push(liElement[itemIdx]);
14133
- removeIdxes.push(i);
14134
- removeLiIdxes.push(itemIdx);
14178
+ var idx = itemIdx === i ? itemIdx : i;
14179
+ liCollections.push(liElement[idx]);
14180
+ removeIdxes.push(idx);
14181
+ removeLiIdxes.push(idx);
14135
14182
  }
14136
14183
  }
14137
14184
  }