@syncfusion/ej2-dropdowns 35.1.37 → 35.1.41

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.
@@ -246,7 +246,6 @@ var MultiSelect = /** @class */ (function (_super) {
246
246
  };
247
247
  MultiSelect.prototype.onPopupShown = function (e) {
248
248
  var _this = this;
249
- this.sanitizeData();
250
249
  if (Browser.isDevice && (this.mode === 'CheckBox' && this.allowFiltering)) {
251
250
  // eslint-disable-next-line @typescript-eslint/no-this-alias
252
251
  var proxy_1 = this;
@@ -1825,6 +1824,9 @@ var MultiSelect = /** @class */ (function (_super) {
1825
1824
  }
1826
1825
  };
1827
1826
  MultiSelect.prototype.showDelimWrapper = function () {
1827
+ if (!this.value || !this.value.length) {
1828
+ return;
1829
+ }
1828
1830
  if (this.mode === 'CheckBox') {
1829
1831
  this.viewWrapper.style.display = '';
1830
1832
  }
@@ -2964,14 +2966,12 @@ var MultiSelect = /** @class */ (function (_super) {
2964
2966
  _this.selectedListData.splice(index, 1);
2965
2967
  }
2966
2968
  _this.setProperties({ value: [].concat([], removeVal) }, true);
2967
- if (_this.enableVirtualization) {
2968
- var currentText = index === 0 && _this.text.split(_this.delimiterChar) &&
2969
- _this.text.split(_this.delimiterChar).length === 1 ?
2970
- _this.text.replace(_this.text.split(_this.delimiterChar)[index], '') :
2971
- index === 0 ? _this.text.replace(_this.text.split(_this.delimiterChar)[index] +
2972
- _this.delimiterChar, '') :
2973
- _this.text.replace(_this.delimiterChar + _this.text.split(_this.delimiterChar)[index], '');
2974
- _this.setProperties({ text: currentText.toString() }, true);
2969
+ if (_this.enableVirtualization && !isNullOrUndefined(_this.text)) {
2970
+ var textItems = _this.text.split(_this.delimiterChar);
2971
+ var currentText = index === 0 && textItems.length === 1
2972
+ ? _this.text.replace(textItems[index], '') : index === 0 ? _this.text.replace(textItems[index]
2973
+ + _this.delimiterChar, '') : _this.text.replace(_this.delimiterChar + textItems[index], '');
2974
+ _this.setProperties({ text: currentText }, true);
2975
2975
  }
2976
2976
  if (element_1 !== null) {
2977
2977
  var currentValue_1 = _this.allowObjectBinding ? getValue(((_this.fields.value) ?
@@ -4094,7 +4094,6 @@ var MultiSelect = /** @class */ (function (_super) {
4094
4094
  }
4095
4095
  this.preventSetCurrentData = false;
4096
4096
  this.initializeData();
4097
- this.sanitizeData();
4098
4097
  this.updateDataAttribute(this.htmlAttributes);
4099
4098
  _super.prototype.preRender.call(this);
4100
4099
  };
@@ -4125,56 +4124,6 @@ var MultiSelect = /** @class */ (function (_super) {
4125
4124
  endIndex: this.itemCount
4126
4125
  };
4127
4126
  };
4128
- MultiSelect.prototype.sanitizeData = function () {
4129
- if (this.enableVirtualization && this.mode === 'CheckBox') {
4130
- if (this.dataSource && Array.isArray(this.dataSource) && !(this.dataSource instanceof DataManager)) {
4131
- var cleanedDataSource = [];
4132
- for (var i = 0; i < this.dataSource.length; i++) {
4133
- var item = this.dataSource[i];
4134
- if (item !== null && item !== undefined && item !== '') {
4135
- if (typeof item === 'object') {
4136
- var itemValue = getValue((this.fields.value ? this.fields.value : 'value'), item);
4137
- if (this.fields.value !== null) {
4138
- if (itemValue !== null && itemValue !== undefined && itemValue !== '') {
4139
- cleanedDataSource.push(item);
4140
- }
4141
- }
4142
- else {
4143
- cleanedDataSource.push(item);
4144
- }
4145
- }
4146
- else if (typeof item === 'string') {
4147
- if (item !== null && item !== undefined && item.trim() !== '') {
4148
- cleanedDataSource.push(item);
4149
- }
4150
- }
4151
- else {
4152
- cleanedDataSource.push(item);
4153
- }
4154
- }
4155
- }
4156
- if (cleanedDataSource.length !== this.dataSource.length) {
4157
- this.setProperties({ dataSource: cleanedDataSource }, true);
4158
- }
4159
- }
4160
- if (this.value && Array.isArray(this.value) && this.value.length > 0) {
4161
- var cleanedValue = [];
4162
- for (var i = 0; i < this.value.length; i++) {
4163
- var val = this.value[i];
4164
- if (val !== null && val !== undefined && val !== '') {
4165
- cleanedValue.push(val);
4166
- }
4167
- }
4168
- if (cleanedValue.length !== this.value.length) {
4169
- this.setProperties({ value: cleanedValue }, true);
4170
- }
4171
- }
4172
- return true;
4173
- }
4174
- else {
4175
- return false;
4176
- }
4177
- };
4178
4127
  MultiSelect.prototype.updateData = function (delimiterChar, e, isInitialVirtualData) {
4179
4128
  var data = '';
4180
4129
  var delim = this.mode === 'Delimiter' || this.mode === 'CheckBox';
@@ -4213,7 +4162,7 @@ var MultiSelect = /** @class */ (function (_super) {
4213
4162
  var value = this_1.allowObjectBinding ?
4214
4163
  getValue(((this_1.fields.value) ? this_1.fields.value : ''), this_1.value[this_1.value.length - 1]) :
4215
4164
  this_1.value[this_1.value.length - 1];
4216
- if (this_1.isRemoveSelection) {
4165
+ if (this_1.isRemoveSelection && this_1.text) {
4217
4166
  data = this_1.text.replace(/,/g, delimiterChar + ' ') + delimiterChar + ' ';
4218
4167
  text = this_1.text.split(delimiterChar);
4219
4168
  }
@@ -4325,7 +4274,6 @@ var MultiSelect = /** @class */ (function (_super) {
4325
4274
  || this.list.querySelector('.e-ul') && this.list.querySelector('.e-ul').childElementCount === 0)) {
4326
4275
  isEmptyData = true;
4327
4276
  }
4328
- this.sanitizeData();
4329
4277
  _super.prototype.render.call(this, null, isEmptyData);
4330
4278
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4331
4279
  this.totalItemCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
@@ -5592,7 +5540,8 @@ var MultiSelect = /** @class */ (function (_super) {
5592
5540
  : (_this.fields.value ? obj[_this.fields.value] : obj);
5593
5541
  var text = isPlainValue
5594
5542
  ? String(obj)
5595
- : (_this.fields.text ? (obj[_this.fields.text]).toString() : String(obj));
5543
+ : (_this.fields.text && obj[_this.fields.text] != null ? (obj[_this.fields.text]).toString()
5544
+ : String(obj));
5596
5545
  if (_this.value && value != null && Array.isArray(_this.value) &&
5597
5546
  ((!_this.allowObjectBinding && _this.value.indexOf(value) < 0) ||
5598
5547
  (_this.allowObjectBinding && !_this.isObjectInArray(value, _this.value)))) {
@@ -6256,7 +6205,6 @@ var MultiSelect = /** @class */ (function (_super) {
6256
6205
  switch (prop) {
6257
6206
  case 'query':
6258
6207
  case 'dataSource':
6259
- this.sanitizeData();
6260
6208
  if (this.mode === 'CheckBox' && this.showSelectAll) {
6261
6209
  if (!isNullOrUndefined(this.popupObj) && !this.isDimColumnWithCustomStyle()) {
6262
6210
  this.popupObj.destroy();
@@ -6274,6 +6222,7 @@ var MultiSelect = /** @class */ (function (_super) {
6274
6222
  this.list.style.visibility = '';
6275
6223
  }
6276
6224
  }
6225
+ this.updateAriaActiveDescendant();
6277
6226
  break;
6278
6227
  case 'htmlAttributes':
6279
6228
  this.updateHTMLAttribute();
@@ -6289,7 +6238,6 @@ var MultiSelect = /** @class */ (function (_super) {
6289
6238
  this.updateVal(this.value, this.value, 'text');
6290
6239
  break;
6291
6240
  case 'value':
6292
- this.sanitizeData();
6293
6241
  if (this.fields.disabled) {
6294
6242
  this.removeDisabledItemsValue(this.value);
6295
6243
  }
@@ -6732,8 +6680,6 @@ var MultiSelect = /** @class */ (function (_super) {
6732
6680
  }
6733
6681
  this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
6734
6682
  var args = { cancel: false };
6735
- var oldValue = extend([], this.value, [], true);
6736
- var oldData = extend([], this.dataSource, [], true);
6737
6683
  this.trigger('beforeOpen', args, function (args) {
6738
6684
  if (!args.cancel) {
6739
6685
  if (!_this.ulElement) {
@@ -6745,50 +6691,6 @@ var MultiSelect = /** @class */ (function (_super) {
6745
6691
  if (_this.inputElement && _this.mode !== 'CheckBox') {
6746
6692
  _this.focusIn();
6747
6693
  }
6748
- if (_this.enableVirtualization && _this.mode === 'CheckBox') {
6749
- if (JSON.stringify(oldData) !== JSON.stringify(_this.dataSource) && _this.sanitizeData() && _this.showSelectAll) {
6750
- _this.renderPopup();
6751
- }
6752
- if (!isNullOrUndefined(oldValue) && !isNullOrUndefined(_this.value) &&
6753
- JSON.stringify(oldValue) !== JSON.stringify(_this.value) && _this.sanitizeData()) {
6754
- if (_this.fields.disabled) {
6755
- _this.removeDisabledItemsValue(_this.value);
6756
- }
6757
- if (!_this.validateValues(_this.value, oldValue)) {
6758
- return;
6759
- }
6760
- if (_this.isVue && !_this.changeOnBlur && !_this.validateValues(_this.value, oldValue)) {
6761
- return;
6762
- }
6763
- _this.updateVal(_this.value, oldValue, 'value', _this.enableVirtualization);
6764
- _this.addValidInputClass();
6765
- if (_this.showSelectAll) {
6766
- _this.renderPopup();
6767
- var totalCount = _this.dataSource instanceof DataManager ? 0 :
6768
- _this.dataSource.length;
6769
- var selectedCount = _this.value ? _this.value.length : 0;
6770
- if (selectedCount === totalCount) {
6771
- var frame = null;
6772
- if (_this.popupObj) {
6773
- frame = _this.popupObj.element.querySelector('.e-selectall-parent .e-frame');
6774
- }
6775
- if (frame) {
6776
- frame.classList.add('e-check');
6777
- frame.classList.remove('e-uncheck');
6778
- frame.classList.remove('e-stop');
6779
- }
6780
- }
6781
- }
6782
- if (!_this.closePopupOnSelect && _this.isPopupOpen()) {
6783
- _this.refreshPopup();
6784
- }
6785
- if (_this.isPopupOpen() && _this.list && _this.list.querySelector('.e-active.e-disable')) {
6786
- var activeItems = _this.list.querySelectorAll('li.' + dropDownBaseClasses.li + '.e-active' + '.e-disable');
6787
- removeClass(activeItems, 'e-disable');
6788
- }
6789
- _this.preventChange = _this.isAngular && _this.preventChange ? !_this.preventChange : _this.preventChange;
6790
- }
6791
- }
6792
6694
  return;
6793
6695
  }
6794
6696
  if (_this.mode === 'CheckBox' && Browser.isDevice && _this.allowFiltering && _this.isDeviceFullScreen) {
@@ -6946,7 +6848,6 @@ var MultiSelect = /** @class */ (function (_super) {
6946
6848
  // eslint-disable-next-line
6947
6849
  this.value = this.value.slice();
6948
6850
  }
6949
- this.sanitizeData();
6950
6851
  this.setDynValue = this.initStatus = false;
6951
6852
  this.isSelectAll = false;
6952
6853
  this.selectAllEventEle = [];