@syncfusion/ej2-dropdowns 28.1.35 → 28.1.37

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.
@@ -544,8 +544,8 @@ var VirtualScroll = /** @__PURE__ @class */ (function () {
544
544
  if (this.parent.hideSelectedItem) {
545
545
  var query = this.parent.value && this.parent.value.length > 0 ?
546
546
  this.parent.getForQuery(this.parent.value).clone() : new Query;
547
- if (this.parent.viewPortInfo.endIndex === this.parent.totalItemCount + this.parent.value.length &&
548
- this.parent.hideSelectedItem) {
547
+ if (this.parent.value && (this.parent.viewPortInfo.endIndex === this.parent.totalItemCount +
548
+ this.parent.value.length) && this.parent.hideSelectedItem) {
549
549
  query = query.skip(this.parent.totalItemCount - this.parent.itemCount);
550
550
  }
551
551
  else {
@@ -1029,58 +1029,60 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
1029
1029
  if (isTextByValue) {
1030
1030
  value = text;
1031
1031
  }
1032
- var dataSource = this.listData;
1033
- var fields = this.fields;
1034
- var type = this.typeOfData(dataSource).typeof;
1035
- if (type === 'string' || type === 'number' || type === 'boolean') {
1036
- for (var _i = 0, dataSource_1 = dataSource; _i < dataSource_1.length; _i++) {
1037
- var item = dataSource_1[_i];
1038
- if (!isNullOrUndefined(item)) {
1039
- if (ignoreAccent) {
1040
- value = this.checkingAccent(String(item), text, ignoreCase);
1041
- }
1042
- else {
1043
- if (ignoreCase) {
1044
- if (this.checkIgnoreCase(String(item), text)) {
1045
- value = this.getItemValue(String(item), text, ignoreCase);
1046
- }
1032
+ if (!isNullOrUndefined(this.listData)) {
1033
+ var dataSource = this.listData;
1034
+ var fields_1 = this.fields;
1035
+ var type = this.typeOfData(dataSource).typeof;
1036
+ if (type === 'string' || type === 'number' || type === 'boolean') {
1037
+ for (var _i = 0, dataSource_1 = dataSource; _i < dataSource_1.length; _i++) {
1038
+ var item = dataSource_1[_i];
1039
+ if (!isNullOrUndefined(item)) {
1040
+ if (ignoreAccent) {
1041
+ value = this.checkingAccent(String(item), text, ignoreCase);
1047
1042
  }
1048
1043
  else {
1049
- if (this.checkNonIgnoreCase(String(item), text)) {
1050
- value = this.getItemValue(String(item), text, ignoreCase, isTextByValue);
1044
+ if (ignoreCase) {
1045
+ if (this.checkIgnoreCase(String(item), text)) {
1046
+ value = this.getItemValue(String(item), text, ignoreCase);
1047
+ }
1048
+ }
1049
+ else {
1050
+ if (this.checkNonIgnoreCase(String(item), text)) {
1051
+ value = this.getItemValue(String(item), text, ignoreCase, isTextByValue);
1052
+ }
1051
1053
  }
1052
1054
  }
1053
1055
  }
1054
1056
  }
1055
1057
  }
1056
- }
1057
- else {
1058
- if (ignoreCase) {
1059
- dataSource.filter(function (item) {
1060
- var itemValue = getValue(fields.value, item);
1061
- if (!isNullOrUndefined(itemValue) && _this.checkIgnoreCase(getValue(fields.text, item).toString(), text)) {
1062
- value = getValue(fields.value, item);
1063
- }
1064
- });
1065
- }
1066
1058
  else {
1067
- if (isTextByValue) {
1068
- var compareValue_1 = null;
1069
- compareValue_1 = value;
1059
+ if (ignoreCase) {
1070
1060
  dataSource.filter(function (item) {
1071
- var itemValue = getValue(fields.value, item);
1072
- if (!isNullOrUndefined(itemValue) && !isNullOrUndefined(value) &&
1073
- itemValue.toString() === compareValue_1.toString()) {
1074
- value = getValue(fields.text, item);
1061
+ var itemValue = getValue(fields_1.value, item);
1062
+ if (!isNullOrUndefined(itemValue) && _this.checkIgnoreCase(getValue(fields_1.text, item).toString(), text)) {
1063
+ value = getValue(fields_1.value, item);
1075
1064
  }
1076
1065
  });
1077
1066
  }
1078
1067
  else {
1079
- dataSource.filter(function (item) {
1080
- if (_this.checkNonIgnoreCase(getValue(fields.text, item), text)) {
1081
- value = getValue(fields.value, item);
1082
- }
1083
- });
1068
+ if (isTextByValue) {
1069
+ var compareValue_1 = null;
1070
+ compareValue_1 = value;
1071
+ dataSource.filter(function (item) {
1072
+ var itemValue = getValue(fields_1.value, item);
1073
+ if (!isNullOrUndefined(itemValue) && !isNullOrUndefined(value) &&
1074
+ itemValue.toString() === compareValue_1.toString()) {
1075
+ value = getValue(fields_1.text, item);
1076
+ }
1077
+ });
1078
+ }
1079
+ else {
1080
+ dataSource.filter(function (item) {
1081
+ if (_this.checkNonIgnoreCase(getValue(fields_1.text, item), text)) {
1082
+ value = getValue(fields_1.value, item);
1083
+ }
1084
+ });
1085
+ }
1084
1086
  }
1085
1087
  }
1086
1088
  }
@@ -1315,7 +1317,7 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
1315
1317
  for (var i = 0; i < totalSkeletonCount; i++) {
1316
1318
  var liElement = this.createElement('li', { className: dropDownBaseClasses.virtualList, styles: 'overflow: inherit' });
1317
1319
  if (this.isVirtualizationEnabled && this.itemTemplate) {
1318
- liElement.style.height = this.listItemHeight + 'px';
1320
+ liElement.style.height = (this.listItemHeight - parseInt(window.getComputedStyle(this.getItems()[1]).marginBottom, 10)) + 'px';
1319
1321
  }
1320
1322
  var skeleton = new Skeleton({
1321
1323
  shape: 'Text',
@@ -1605,7 +1607,6 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
1605
1607
  _this.isRequested = false;
1606
1608
  _this.bindChildItems(listItems, ulElement, fields, e);
1607
1609
  if (_this.getInitialData) {
1608
- _this.setListData(dataSource, fields, query, event);
1609
1610
  _this.getInitialData = false;
1610
1611
  _this.preventPopupOpen = false;
1611
1612
  return;
@@ -2000,7 +2001,8 @@ var DropDownBase = /** @__PURE__ @class */ (function (_super) {
2000
2001
  };
2001
2002
  DropDownBase.prototype.scrollStop = function (e, isDownkey) {
2002
2003
  var target = !isNullOrUndefined(e) ? e.target : this.list;
2003
- var liHeight = parseInt(getComputedStyle(this.getValidLi(), null).getPropertyValue('height'), 10);
2004
+ var computedHeight = getComputedStyle(this.getValidLi(), null).getPropertyValue('height');
2005
+ var liHeight = this.getModuleName() === 'multiselect' ? parseFloat(computedHeight) : parseInt(computedHeight, 10);
2004
2006
  var topIndex = Math.round(target.scrollTop / liHeight);
2005
2007
  var liCollections = this.list.querySelectorAll('li' + ':not(.e-hide-listitem)');
2006
2008
  var virtualListCount = this.list.querySelectorAll('.e-virtual-list').length;
@@ -4697,6 +4699,7 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
4697
4699
  DropDownList.prototype.onFilterUp = function (e) {
4698
4700
  if (!(e.ctrlKey && e.keyCode === 86) && (this.isValidKey || e.keyCode === 40 || e.keyCode === 38)) {
4699
4701
  this.isValidKey = false;
4702
+ this.filterArgs = e;
4700
4703
  this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
4701
4704
  switch (e.keyCode) {
4702
4705
  case 38: //up arrow
@@ -4750,7 +4753,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
4750
4753
  }
4751
4754
  this.typedString = this.filterInput.value;
4752
4755
  this.preventAutoFill = false;
4753
- this.searchLists(e);
4756
+ if (!this.getInitialData) {
4757
+ this.searchLists(e);
4758
+ }
4754
4759
  if ((this.enableVirtualization && this.getModuleName() !== 'autocomplete') || (this.getModuleName() === 'autocomplete' && !(this.dataSource instanceof DataManager)) || (this.getModuleName() === 'autocomplete' && (this.dataSource instanceof DataManager) && this.totalItemCount !== 0)) {
4755
4760
  this.getFilteringSkeletonCount();
4756
4761
  }
@@ -5098,6 +5103,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
5098
5103
  var _this = this;
5099
5104
  setTimeout(function () {
5100
5105
  _this.typedString = _this.filterInput.value;
5106
+ if (_this.getModuleName() === 'combobox' && _this.isFiltering() && isNullOrUndefined(_this.list)) {
5107
+ _this.renderList();
5108
+ }
5101
5109
  _this.searchLists(e);
5102
5110
  });
5103
5111
  };
@@ -5123,10 +5131,9 @@ var DropDownList = /** @__PURE__ @class */ (function (_super) {
5123
5131
  }
5124
5132
  if (this.getInitialData) {
5125
5133
  this.updateActionCompleteDataValues(ulElement, list);
5126
- }
5127
- if (!this.preventPopupOpen && this.getModuleName() === 'combobox') {
5128
- this.beforePopupOpen = true;
5129
- this.preventPopupOpen = true;
5134
+ this.getInitialData = false;
5135
+ this.searchLists(this.filterArgs);
5136
+ return;
5130
5137
  }
5131
5138
  var tempItemCount = this.itemCount;
5132
5139
  if (this.isActive || !isNullOrUndefined(ulElement)) {
@@ -7761,6 +7768,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
7761
7768
  }
7762
7769
  else if (args.preventDefaultAction) {
7763
7770
  fields = args.fields;
7771
+ _this.treeObj.element.classList.add('e-filtering');
7764
7772
  }
7765
7773
  else {
7766
7774
  if (_this.treeDataType === 1) {
@@ -8086,8 +8094,8 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
8086
8094
  }
8087
8095
  addClass([this.inputEle], CHIP_INPUT);
8088
8096
  this.updateOverFlowView();
8089
- this.ensurePlaceHolder();
8090
8097
  }
8098
+ this.ensurePlaceHolder();
8091
8099
  };
8092
8100
  DropDownTree.prototype.triggerChangeEvent = function (event) {
8093
8101
  var isEqual = this.ddtCompareValues(this.oldValue, this.value);
@@ -8697,10 +8705,10 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
8697
8705
  if (this.value !== null && this.value.length !== 0) {
8698
8706
  var data = void 0;
8699
8707
  if (this.showCheckBox || this.allowMultiSelection) {
8700
- for (var i = 0; i < this.value.length; i++) {
8708
+ for (var i = this.value.length - 1; i >= 0; i--) {
8701
8709
  data = this.treeObj.getTreeData(this.value[i])[0];
8702
8710
  if (isNullOrUndefined(data)) {
8703
- this.value.splice(this.value.indexOf(this.value[i]), 1);
8711
+ this.value.splice(i, 1);
8704
8712
  }
8705
8713
  }
8706
8714
  if (this.value.length !== 0) {
@@ -8757,7 +8765,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
8757
8765
  }
8758
8766
  };
8759
8767
  DropDownTree.prototype.setSelectedValue = function () {
8760
- if (this.value != null) {
8768
+ if (this.value !== null && !(this.value.length === 0)) {
8761
8769
  return;
8762
8770
  }
8763
8771
  if (!this.isInitialized) {
@@ -9184,7 +9192,9 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
9184
9192
  }
9185
9193
  if (this.isFilterRestore) {
9186
9194
  this.restoreFilterSelection();
9187
- this.isFilterRestore = false;
9195
+ if (!this.showSelectAll) {
9196
+ this.isFilterRestore = false;
9197
+ }
9188
9198
  }
9189
9199
  };
9190
9200
  DropDownTree.prototype.restoreFilterSelection = function () {
@@ -9447,15 +9457,18 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
9447
9457
  this.ensurePlaceHolder();
9448
9458
  }
9449
9459
  if (this.showSelectAll && this.checkBoxElement) {
9460
+ var nodes = this.treeObj.element.querySelectorAll('li');
9450
9461
  var checkedNodes = this.treeObj.element.querySelectorAll('li[aria-checked=true]');
9451
9462
  var wrap = closest(this.checkBoxElement, '.' + CHECKBOXWRAP);
9452
- if (wrap && args.action === 'uncheck' && (args.isInteracted || checkedNodes.length === 0 || (!isNullOrUndefined(args.data[0]) && args.data[0].isChecked === 'false'))) {
9463
+ if ((wrap && args.action === 'uncheck' && (args.isInteracted || checkedNodes.length === 0 ||
9464
+ (!isNullOrUndefined(args.data[0]) && args.data[0].isChecked === 'false'))) || !args.isInteracted && this.isFilterRestore) {
9465
+ this.isFilterRestore = false;
9453
9466
  this.isReverseUpdate = true;
9454
9467
  this.changeState(wrap, 'uncheck');
9455
9468
  this.isReverseUpdate = false;
9456
9469
  }
9457
9470
  else if (wrap && args.action === 'check'
9458
- && checkedNodes.length === this.fields.dataSource.length
9471
+ && checkedNodes.length === nodes.length
9459
9472
  && (args.isInteracted || this.isCheckAllCalled || (!isNullOrUndefined(args.data[0]) && args.data[0].isChecked === 'true'))) {
9460
9473
  this.isReverseUpdate = true;
9461
9474
  this.isCheckAllCalled = false;
@@ -9562,7 +9575,7 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
9562
9575
  }
9563
9576
  };
9564
9577
  DropDownTree.prototype.ensurePlaceHolder = function () {
9565
- if (isNullOrUndefined(this.value) || (this.value && this.value.length === 0)) {
9578
+ if (isNullOrUndefined(this.value) || (this.value !== null && this.value.length === 0)) {
9566
9579
  removeClass([this.inputEle], CHIP_INPUT);
9567
9580
  if (this.chipWrapper) {
9568
9581
  addClass([this.chipWrapper], HIDEICON);
@@ -9865,7 +9878,10 @@ var DropDownTree = /** @__PURE__ @class */ (function (_super) {
9865
9878
  }
9866
9879
  };
9867
9880
  DropDownTree.prototype.setTagValues = function () {
9868
- if (this.value === null || this.text == null) {
9881
+ if (this.value === null || this.text == null || this.value.length === 0) {
9882
+ if (this.inputWrapper.contains(this.chipWrapper)) {
9883
+ addClass([this.chipWrapper], HIDEICON);
9884
+ }
9869
9885
  return;
9870
9886
  }
9871
9887
  if (!this.inputWrapper.contains(this.chipWrapper)) {
@@ -13451,6 +13467,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
13451
13467
  if (this.isFiltered) {
13452
13468
  if ((this.enableVirtualization && !isNullOrUndefined(this.customFilterQuery))) {
13453
13469
  filterQuery = this.customFilterQuery.clone();
13470
+ return this.virtualFilterQuery(filterQuery);
13454
13471
  }
13455
13472
  else if (!this.enableVirtualization) {
13456
13473
  return filterQuery;
@@ -15296,7 +15313,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
15296
15313
  getValue(((this.fields.value) ? this.fields.value : ''), this.value[this.value.length - 1]) :
15297
15314
  this.value[this.value.length - 1];
15298
15315
  var temp = text;
15299
- var textValues = this.text != null && this.text !== '' ? this.text + ',' + temp : temp;
15316
+ var textValues = this.text != null && this.text !== '' ? this.text + this.delimiterChar + temp : temp;
15300
15317
  currentText.push(textValues);
15301
15318
  this.setProperties({ text: currentText.toString() }, true);
15302
15319
  }
@@ -15886,7 +15903,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
15886
15903
  this.list.scrollTop = 0;
15887
15904
  this.virtualListInfo = null;
15888
15905
  this.previousStartIndex = 0;
15889
- this.previousEndIndex = 0;
15906
+ this.previousEndIndex = this.itemCount;
15890
15907
  }
15891
15908
  this.isClearAllAction = false;
15892
15909
  }
@@ -16231,7 +16248,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16231
16248
  }
16232
16249
  else {
16233
16250
  temp = isInitialVirtualData && delim ? this_1.text : this_1.getTextByValue(value);
16234
- var textValues = isInitialVirtualData ? this_1.text : (this_1.text && this_1.text !== '' ? this_1.text + ',' + temp : temp);
16251
+ var textValues = isInitialVirtualData ? this_1.text : (this_1.text && this_1.text !== '' ? this_1.text + this_1.delimiterChar + temp : temp);
16235
16252
  data += temp + delimiterChar + ' ';
16236
16253
  text.push(textValues);
16237
16254
  hiddenElementContent = this_1.hiddenElement.innerHTML;
@@ -16399,7 +16416,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16399
16416
  (this.mode === 'Box' || this.mode === 'Default'))) ||
16400
16417
  (this.enableVirtualization && value != null && text != null && !isCustomData)) {
16401
16418
  var currentText = [];
16402
- var textValues = this.text != null && this.text !== '' ? this.text + ',' + text : text;
16419
+ var textValues = this.text != null && this.text !== '' ? this.text + this.delimiterChar + text : text;
16403
16420
  currentText.push(textValues);
16404
16421
  this.setProperties({ text: currentText.toString() }, true);
16405
16422
  this.addChip(text, value);
@@ -16435,7 +16452,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
16435
16452
  this.wireListEvents();
16436
16453
  }
16437
16454
  var currentText = [];
16438
- var textValues = this.text != null && this.text !== '' ? this.text + ',' + text : text;
16455
+ var textValues = this.text != null && this.text !== '' ? this.text + this.delimiterChar + text : text;
16439
16456
  currentText.push(textValues);
16440
16457
  this.setProperties({ text: currentText.toString() }, true);
16441
16458
  this.addChip(text, value);
@@ -18078,7 +18095,7 @@ var MultiSelect = /** @__PURE__ @class */ (function (_super) {
18078
18095
  _this.viewPortInfo.endIndex : _this.itemCount;
18079
18096
  _this.virtualListInfo = _this.viewPortInfo;
18080
18097
  _this.previousStartIndex = 0;
18081
- _this.previousEndIndex = 0;
18098
+ _this.previousEndIndex = _this.itemCount;
18082
18099
  }
18083
18100
  var dataSourceCount = void 0;
18084
18101
  if (_this.dataSource instanceof DataManager) {
@@ -21562,7 +21579,7 @@ var ListBox = /** @__PURE__ @class */ (function (_super) {
21562
21579
  ctrlKey: e.ctrlKey, shiftKey: e.shiftKey
21563
21580
  });
21564
21581
  }
21565
- else if (e.keyCode === 65 && e.ctrlKey) {
21582
+ else if (e.keyCode === 65 && e.ctrlKey && this.selectionSettings.mode === 'Multiple') {
21566
21583
  this.selectAll();
21567
21584
  }
21568
21585
  else if ((e.keyCode === 38 || e.keyCode === 40) && e.ctrlKey && e.shiftKey) {
@@ -22550,6 +22567,7 @@ var Mention = /** @__PURE__ @class */ (function (_super) {
22550
22567
  e.preventDefault();
22551
22568
  var li = this.list.querySelector('.' + dropDownBaseClasses.selected);
22552
22569
  if (li) {
22570
+ this.isSelected = true;
22553
22571
  this.setSelection(li, e);
22554
22572
  }
22555
22573
  if (this.isPopupOpen) {