@syncfusion/ej2-dropdowns 19.4.41 → 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 (68) hide show
  1. package/CHANGELOG.md +20 -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 +61 -7
  5. package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
  6. package/dist/es6/ej2-dropdowns.es5.js +138 -79
  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 +11 -11
  12. package/src/drop-down-base/drop-down-base.js +12 -1
  13. package/src/drop-down-list/drop-down-list.js +107 -72
  14. package/src/list-box/list-box.js +4 -3
  15. package/src/multi-select/multi-select.js +12 -0
  16. package/styles/bootstrap-dark.css +18 -4
  17. package/styles/bootstrap.css +18 -4
  18. package/styles/bootstrap4.css +18 -4
  19. package/styles/bootstrap5-dark.css +18 -4
  20. package/styles/bootstrap5.css +18 -4
  21. package/styles/fabric-dark.css +18 -4
  22. package/styles/fabric.css +18 -4
  23. package/styles/highcontrast-light.css +18 -4
  24. package/styles/highcontrast.css +18 -4
  25. package/styles/list-box/_bootstrap-dark-definition.scss +3 -0
  26. package/styles/list-box/_bootstrap-definition.scss +3 -0
  27. package/styles/list-box/_bootstrap4-definition.scss +3 -0
  28. package/styles/list-box/_bootstrap5-definition.scss +3 -0
  29. package/styles/list-box/_fabric-dark-definition.scss +3 -0
  30. package/styles/list-box/_fabric-definition.scss +3 -0
  31. package/styles/list-box/_fluent-definition.scss +3 -0
  32. package/styles/list-box/_highcontrast-definition.scss +3 -0
  33. package/styles/list-box/_highcontrast-light-definition.scss +3 -0
  34. package/styles/list-box/_material-dark-definition.scss +3 -0
  35. package/styles/list-box/_material-definition.scss +3 -0
  36. package/styles/list-box/_tailwind-definition.scss +3 -0
  37. package/styles/list-box/_theme.scss +8 -0
  38. package/styles/list-box/bootstrap-dark.css +10 -0
  39. package/styles/list-box/bootstrap.css +10 -0
  40. package/styles/list-box/bootstrap4.css +10 -0
  41. package/styles/list-box/bootstrap5-dark.css +10 -0
  42. package/styles/list-box/bootstrap5.css +10 -0
  43. package/styles/list-box/fabric-dark.css +10 -0
  44. package/styles/list-box/fabric.css +10 -0
  45. package/styles/list-box/highcontrast-light.css +10 -0
  46. package/styles/list-box/highcontrast.css +10 -0
  47. package/styles/list-box/material-dark.css +10 -0
  48. package/styles/list-box/material.css +10 -0
  49. package/styles/list-box/tailwind-dark.css +10 -0
  50. package/styles/list-box/tailwind.css +10 -0
  51. package/styles/material-dark.css +18 -4
  52. package/styles/material.css +18 -4
  53. package/styles/multi-select/_layout.scss +6 -4
  54. package/styles/multi-select/bootstrap-dark.css +8 -4
  55. package/styles/multi-select/bootstrap.css +8 -4
  56. package/styles/multi-select/bootstrap4.css +8 -4
  57. package/styles/multi-select/bootstrap5-dark.css +8 -4
  58. package/styles/multi-select/bootstrap5.css +8 -4
  59. package/styles/multi-select/fabric-dark.css +8 -4
  60. package/styles/multi-select/fabric.css +8 -4
  61. package/styles/multi-select/highcontrast-light.css +8 -4
  62. package/styles/multi-select/highcontrast.css +8 -4
  63. package/styles/multi-select/material-dark.css +8 -4
  64. package/styles/multi-select/material.css +8 -4
  65. package/styles/multi-select/tailwind-dark.css +8 -4
  66. package/styles/multi-select/tailwind.css +8 -4
  67. package/styles/tailwind-dark.css +18 -4
  68. package/styles/tailwind.css +18 -4
@@ -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');
@@ -1225,7 +1235,8 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
1225
1235
  li.innerText = itemText;
1226
1236
  }
1227
1237
  if (this.itemTemplate && !isHeader) {
1228
- var compiledString = compile(this.itemTemplate);
1238
+ var itemCheck = this.templateCompiler(this.itemTemplate);
1239
+ var compiledString = itemCheck ? compile(select(this.itemTemplate, document).innerHTML.trim()) : compile(this.itemTemplate);
1229
1240
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1230
1241
  var addItemTemplate = compiledString(item, this, 'itemTemplate', this.itemTemplateId, this.isStringTemplate, null, li);
1231
1242
  if (addItemTemplate) {
@@ -3665,7 +3676,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3665
3676
  DropDownList.prototype.checkCustomValue = function () {
3666
3677
  this.itemData = this.getDataByValue(this.value);
3667
3678
  var dataItem = this.getItemData();
3668
- this.setProperties({ 'value': dataItem.value, 'text': dataItem.text });
3679
+ this.setProperties({ 'text': dataItem.text, 'value': dataItem.value });
3669
3680
  };
3670
3681
  DropDownList.prototype.updateInputFields = function () {
3671
3682
  if (this.getModuleName() === 'dropdownlist') {
@@ -3681,160 +3692,195 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
3681
3692
  * @returns {void}
3682
3693
  */
3683
3694
  DropDownList.prototype.onPropertyChanged = function (newProp, oldProp) {
3695
+ var _this = this;
3684
3696
  if (this.getModuleName() === 'dropdownlist') {
3685
3697
  this.checkData(newProp);
3686
3698
  this.setUpdateInitial(['fields', 'query', 'dataSource'], newProp);
3687
3699
  }
3688
- for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
3689
- var prop = _a[_i];
3700
+ var _loop_1 = function (prop) {
3690
3701
  switch (prop) {
3691
3702
  case 'query':
3692
3703
  case 'dataSource': break;
3693
3704
  case 'htmlAttributes':
3694
- this.setHTMLAttributes();
3705
+ this_1.setHTMLAttributes();
3695
3706
  break;
3696
3707
  case 'width':
3697
- this.setEleWidth(newProp.width);
3708
+ this_1.setEleWidth(newProp.width);
3698
3709
  break;
3699
3710
  case 'placeholder':
3700
- Input.setPlaceholder(newProp.placeholder, this.inputElement);
3711
+ Input.setPlaceholder(newProp.placeholder, this_1.inputElement);
3701
3712
  break;
3702
3713
  case 'filterBarPlaceholder':
3703
- if (this.filterInput) {
3704
- Input.setPlaceholder(newProp.filterBarPlaceholder, this.filterInput);
3714
+ if (this_1.filterInput) {
3715
+ Input.setPlaceholder(newProp.filterBarPlaceholder, this_1.filterInput);
3705
3716
  }
3706
3717
  break;
3707
3718
  case 'readonly':
3708
- if (this.getModuleName() !== 'dropdownlist') {
3709
- Input.setReadonly(newProp.readonly, this.inputElement);
3719
+ if (this_1.getModuleName() !== 'dropdownlist') {
3720
+ Input.setReadonly(newProp.readonly, this_1.inputElement);
3710
3721
  }
3711
- this.setReadOnly();
3722
+ this_1.setReadOnly();
3712
3723
  break;
3713
3724
  case 'cssClass':
3714
- this.setCssClass(newProp.cssClass, oldProp.cssClass);
3725
+ this_1.setCssClass(newProp.cssClass, oldProp.cssClass);
3715
3726
  break;
3716
3727
  case 'enableRtl':
3717
- this.setEnableRtl();
3728
+ this_1.setEnableRtl();
3718
3729
  break;
3719
3730
  case 'enabled':
3720
- this.setEnable();
3731
+ this_1.setEnable();
3721
3732
  break;
3722
3733
  case 'text':
3723
3734
  if (newProp.text === null) {
3724
- this.clearAll();
3735
+ this_1.clearAll();
3725
3736
  break;
3726
3737
  }
3727
- if (!this.list) {
3728
- if (this.dataSource instanceof DataManager) {
3729
- this.initRemoteRender = true;
3738
+ if (!this_1.list) {
3739
+ if (this_1.dataSource instanceof DataManager) {
3740
+ this_1.initRemoteRender = true;
3730
3741
  }
3731
- this.renderList();
3732
- }
3733
- if (!this.initRemoteRender) {
3734
- var li = this.getElementByText(newProp.text);
3735
- if (!this.checkValidLi(li)) {
3736
- if (this.liCollections && this.liCollections.length === 100 &&
3737
- this.getModuleName() === 'autocomplete' && this.listData.length > 100) {
3738
- 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
+ });
3739
3765
  }
3740
3766
  else {
3741
- this.setOldText(oldProp.text);
3767
+ this_1.setOldText(oldProp.text);
3742
3768
  }
3743
3769
  }
3744
- this.updateInputFields();
3770
+ this_1.updateInputFields();
3745
3771
  }
3746
3772
  break;
3747
3773
  case 'value':
3748
3774
  if (newProp.value === null) {
3749
- this.clearAll();
3775
+ this_1.clearAll();
3750
3776
  break;
3751
3777
  }
3752
- this.notify('beforeValueChange', { newProp: newProp }); // gird component value type change
3753
- if (!this.list) {
3754
- if (this.dataSource instanceof DataManager) {
3755
- 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;
3756
3782
  }
3757
- this.renderList();
3758
- }
3759
- if (!this.initRemoteRender) {
3760
- var item = this.getElementByValue(newProp.value);
3761
- if (!this.checkValidLi(item)) {
3762
- if (this.liCollections && this.liCollections.length === 100 &&
3763
- this.getModuleName() === 'autocomplete' && this.listData.length > 100) {
3764
- 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
+ });
3765
3806
  }
3766
3807
  else {
3767
- this.setOldValue(oldProp.value);
3808
+ this_1.setOldValue(oldProp.value);
3768
3809
  }
3769
3810
  }
3770
- this.updateInputFields();
3771
- 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;
3772
3813
  }
3773
3814
  break;
3774
3815
  case 'index':
3775
3816
  if (newProp.index === null) {
3776
- this.clearAll();
3817
+ this_1.clearAll();
3777
3818
  break;
3778
3819
  }
3779
- if (!this.list) {
3780
- if (this.dataSource instanceof DataManager) {
3781
- this.initRemoteRender = true;
3820
+ if (!this_1.list) {
3821
+ if (this_1.dataSource instanceof DataManager) {
3822
+ this_1.initRemoteRender = true;
3782
3823
  }
3783
- this.renderList();
3784
- }
3785
- if (!this.initRemoteRender && this.liCollections) {
3786
- var element = this.liCollections[newProp.index];
3787
- if (!this.checkValidLi(element)) {
3788
- if (this.liCollections && this.liCollections.length === 100 &&
3789
- this.getModuleName() === 'autocomplete' && this.listData.length > 100) {
3790
- 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');
3791
3832
  }
3792
3833
  else {
3793
- this.index = oldProp.index;
3834
+ this_1.index = oldProp.index;
3794
3835
  }
3795
3836
  }
3796
- this.updateInputFields();
3837
+ this_1.updateInputFields();
3797
3838
  }
3798
3839
  break;
3799
3840
  case 'footerTemplate':
3800
- if (this.popupObj) {
3801
- this.setFooterTemplate(this.popupObj.element);
3841
+ if (this_1.popupObj) {
3842
+ this_1.setFooterTemplate(this_1.popupObj.element);
3802
3843
  }
3803
3844
  break;
3804
3845
  case 'headerTemplate':
3805
- if (this.popupObj) {
3806
- this.setHeaderTemplate(this.popupObj.element);
3846
+ if (this_1.popupObj) {
3847
+ this_1.setHeaderTemplate(this_1.popupObj.element);
3807
3848
  }
3808
3849
  break;
3809
3850
  case 'valueTemplate':
3810
- if (!isNullOrUndefined(this.itemData) && this.valueTemplate != null) {
3811
- this.setValueTemplate();
3851
+ if (!isNullOrUndefined(this_1.itemData) && this_1.valueTemplate != null) {
3852
+ this_1.setValueTemplate();
3812
3853
  }
3813
3854
  break;
3814
3855
  case 'allowFiltering':
3815
- if (this.allowFiltering) {
3816
- this.actionCompleteData = { ulElement: this.ulElement,
3817
- list: this.listData, isUpdated: true };
3818
- this.actionData = this.actionCompleteData;
3819
- 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);
3820
3861
  }
3821
3862
  break;
3822
3863
  case 'floatLabelType':
3823
- Input.removeFloating(this.inputWrapper);
3824
- 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);
3825
3866
  break;
3826
3867
  case 'showClearButton':
3827
- Input.setClearButton(newProp.showClearButton, this.inputElement, this.inputWrapper, null, this.createElement);
3828
- this.bindClearEvent();
3868
+ Input.setClearButton(newProp.showClearButton, this_1.inputElement, this_1.inputWrapper, null, this_1.createElement);
3869
+ this_1.bindClearEvent();
3829
3870
  break;
3830
3871
  default:
3831
3872
  {
3832
3873
  // eslint-disable-next-line max-len
3833
- var ddlProps = this.getPropObject(prop, newProp, oldProp);
3834
- _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);
3835
3876
  }
3836
3877
  break;
3837
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);
3838
3884
  }
3839
3885
  };
3840
3886
  DropDownList.prototype.checkValidLi = function (element) {
@@ -12210,6 +12256,17 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
12210
12256
  this.notify('selectAllText', false);
12211
12257
  break;
12212
12258
  case 'popupHeight':
12259
+ if (this.popupObj) {
12260
+ var overAllHeight = parseInt(this.popupHeight, 10);
12261
+ if (this.popupHeight !== 'auto') {
12262
+ this.list.style.maxHeight = formatUnit(overAllHeight);
12263
+ this.popupWrapper.style.maxHeight = formatUnit(this.popupHeight);
12264
+ }
12265
+ else {
12266
+ this.list.style.maxHeight = formatUnit(this.popupHeight);
12267
+ }
12268
+ }
12269
+ break;
12213
12270
  case 'headerTemplate':
12214
12271
  case 'footerTemplate':
12215
12272
  this.reInitializePoup();
@@ -12664,6 +12721,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
12664
12721
  this.mainData = null;
12665
12722
  this.filterParent = null;
12666
12723
  this.ulElement = null;
12724
+ this.mainListCollection = null;
12667
12725
  _super.prototype.destroy.call(this);
12668
12726
  var temp = ['readonly', 'aria-disabled', 'aria-placeholder', 'placeholder'];
12669
12727
  var length = temp.length;
@@ -14117,9 +14175,10 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
14117
14175
  }
14118
14176
  if (objValue === dataValue) {
14119
14177
  itemIdx = this.getIndexByValue(dataValue);
14120
- liCollections.push(liElement[itemIdx]);
14121
- removeIdxes.push(i);
14122
- removeLiIdxes.push(itemIdx);
14178
+ var idx = itemIdx === i ? itemIdx : i;
14179
+ liCollections.push(liElement[idx]);
14180
+ removeIdxes.push(idx);
14181
+ removeLiIdxes.push(idx);
14123
14182
  }
14124
14183
  }
14125
14184
  }