@syncfusion/ej2-dropdowns 28.1.36 → 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.
@@ -496,8 +496,8 @@ class VirtualScroll {
496
496
  if (this.parent.hideSelectedItem) {
497
497
  let query = this.parent.value && this.parent.value.length > 0 ?
498
498
  this.parent.getForQuery(this.parent.value).clone() : new Query;
499
- if (this.parent.viewPortInfo.endIndex === this.parent.totalItemCount + this.parent.value.length &&
500
- this.parent.hideSelectedItem) {
499
+ if (this.parent.value && (this.parent.viewPortInfo.endIndex === this.parent.totalItemCount +
500
+ this.parent.value.length) && this.parent.hideSelectedItem) {
501
501
  query = query.skip(this.parent.totalItemCount - this.parent.itemCount);
502
502
  }
503
503
  else {
@@ -949,57 +949,59 @@ let DropDownBase = class DropDownBase extends Component {
949
949
  if (isTextByValue) {
950
950
  value = text;
951
951
  }
952
- const dataSource = this.listData;
953
- const fields = this.fields;
954
- const type = this.typeOfData(dataSource).typeof;
955
- if (type === 'string' || type === 'number' || type === 'boolean') {
956
- for (const item of dataSource) {
957
- if (!isNullOrUndefined(item)) {
958
- if (ignoreAccent) {
959
- value = this.checkingAccent(String(item), text, ignoreCase);
960
- }
961
- else {
962
- if (ignoreCase) {
963
- if (this.checkIgnoreCase(String(item), text)) {
964
- value = this.getItemValue(String(item), text, ignoreCase);
965
- }
952
+ if (!isNullOrUndefined(this.listData)) {
953
+ const dataSource = this.listData;
954
+ const fields = this.fields;
955
+ const type = this.typeOfData(dataSource).typeof;
956
+ if (type === 'string' || type === 'number' || type === 'boolean') {
957
+ for (const item of dataSource) {
958
+ if (!isNullOrUndefined(item)) {
959
+ if (ignoreAccent) {
960
+ value = this.checkingAccent(String(item), text, ignoreCase);
966
961
  }
967
962
  else {
968
- if (this.checkNonIgnoreCase(String(item), text)) {
969
- value = this.getItemValue(String(item), text, ignoreCase, isTextByValue);
963
+ if (ignoreCase) {
964
+ if (this.checkIgnoreCase(String(item), text)) {
965
+ value = this.getItemValue(String(item), text, ignoreCase);
966
+ }
967
+ }
968
+ else {
969
+ if (this.checkNonIgnoreCase(String(item), text)) {
970
+ value = this.getItemValue(String(item), text, ignoreCase, isTextByValue);
971
+ }
970
972
  }
971
973
  }
972
974
  }
973
975
  }
974
976
  }
975
- }
976
- else {
977
- if (ignoreCase) {
978
- dataSource.filter((item) => {
979
- const itemValue = getValue(fields.value, item);
980
- if (!isNullOrUndefined(itemValue) && this.checkIgnoreCase(getValue(fields.text, item).toString(), text)) {
981
- value = getValue(fields.value, item);
982
- }
983
- });
984
- }
985
977
  else {
986
- if (isTextByValue) {
987
- let compareValue = null;
988
- compareValue = value;
978
+ if (ignoreCase) {
989
979
  dataSource.filter((item) => {
990
980
  const itemValue = getValue(fields.value, item);
991
- if (!isNullOrUndefined(itemValue) && !isNullOrUndefined(value) &&
992
- itemValue.toString() === compareValue.toString()) {
993
- value = getValue(fields.text, item);
981
+ if (!isNullOrUndefined(itemValue) && this.checkIgnoreCase(getValue(fields.text, item).toString(), text)) {
982
+ value = getValue(fields.value, item);
994
983
  }
995
984
  });
996
985
  }
997
986
  else {
998
- dataSource.filter((item) => {
999
- if (this.checkNonIgnoreCase(getValue(fields.text, item), text)) {
1000
- value = getValue(fields.value, item);
1001
- }
1002
- });
987
+ if (isTextByValue) {
988
+ let compareValue = null;
989
+ compareValue = value;
990
+ dataSource.filter((item) => {
991
+ const itemValue = getValue(fields.value, item);
992
+ if (!isNullOrUndefined(itemValue) && !isNullOrUndefined(value) &&
993
+ itemValue.toString() === compareValue.toString()) {
994
+ value = getValue(fields.text, item);
995
+ }
996
+ });
997
+ }
998
+ else {
999
+ dataSource.filter((item) => {
1000
+ if (this.checkNonIgnoreCase(getValue(fields.text, item), text)) {
1001
+ value = getValue(fields.value, item);
1002
+ }
1003
+ });
1004
+ }
1003
1005
  }
1004
1006
  }
1005
1007
  }
@@ -1521,7 +1523,6 @@ let DropDownBase = class DropDownBase extends Component {
1521
1523
  this.isRequested = false;
1522
1524
  this.bindChildItems(listItems, ulElement, fields, e);
1523
1525
  if (this.getInitialData) {
1524
- this.setListData(dataSource, fields, query, event);
1525
1526
  this.getInitialData = false;
1526
1527
  this.preventPopupOpen = false;
1527
1528
  return;
@@ -1915,7 +1916,8 @@ let DropDownBase = class DropDownBase extends Component {
1915
1916
  }
1916
1917
  scrollStop(e, isDownkey) {
1917
1918
  const target = !isNullOrUndefined(e) ? e.target : this.list;
1918
- const liHeight = parseInt(getComputedStyle(this.getValidLi(), null).getPropertyValue('height'), 10);
1919
+ const computedHeight = getComputedStyle(this.getValidLi(), null).getPropertyValue('height');
1920
+ const liHeight = this.getModuleName() === 'multiselect' ? parseFloat(computedHeight) : parseInt(computedHeight, 10);
1919
1921
  const topIndex = Math.round(target.scrollTop / liHeight);
1920
1922
  const liCollections = this.list.querySelectorAll('li' + ':not(.e-hide-listitem)');
1921
1923
  const virtualListCount = this.list.querySelectorAll('.e-virtual-list').length;
@@ -4587,6 +4589,7 @@ let DropDownList = class DropDownList extends DropDownBase {
4587
4589
  onFilterUp(e) {
4588
4590
  if (!(e.ctrlKey && e.keyCode === 86) && (this.isValidKey || e.keyCode === 40 || e.keyCode === 38)) {
4589
4591
  this.isValidKey = false;
4592
+ this.filterArgs = e;
4590
4593
  this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
4591
4594
  switch (e.keyCode) {
4592
4595
  case 38: //up arrow
@@ -4640,7 +4643,9 @@ let DropDownList = class DropDownList extends DropDownBase {
4640
4643
  }
4641
4644
  this.typedString = this.filterInput.value;
4642
4645
  this.preventAutoFill = false;
4643
- this.searchLists(e);
4646
+ if (!this.getInitialData) {
4647
+ this.searchLists(e);
4648
+ }
4644
4649
  if ((this.enableVirtualization && this.getModuleName() !== 'autocomplete') || (this.getModuleName() === 'autocomplete' && !(this.dataSource instanceof DataManager)) || (this.getModuleName() === 'autocomplete' && (this.dataSource instanceof DataManager) && this.totalItemCount !== 0)) {
4645
4650
  this.getFilteringSkeletonCount();
4646
4651
  }
@@ -4985,6 +4990,9 @@ let DropDownList = class DropDownList extends DropDownBase {
4985
4990
  pasteHandler(e) {
4986
4991
  setTimeout(() => {
4987
4992
  this.typedString = this.filterInput.value;
4993
+ if (this.getModuleName() === 'combobox' && this.isFiltering() && isNullOrUndefined(this.list)) {
4994
+ this.renderList();
4995
+ }
4988
4996
  this.searchLists(e);
4989
4997
  });
4990
4998
  }
@@ -5009,10 +5017,9 @@ let DropDownList = class DropDownList extends DropDownBase {
5009
5017
  }
5010
5018
  if (this.getInitialData) {
5011
5019
  this.updateActionCompleteDataValues(ulElement, list);
5012
- }
5013
- if (!this.preventPopupOpen && this.getModuleName() === 'combobox') {
5014
- this.beforePopupOpen = true;
5015
- this.preventPopupOpen = true;
5020
+ this.getInitialData = false;
5021
+ this.searchLists(this.filterArgs);
5022
+ return;
5016
5023
  }
5017
5024
  const tempItemCount = this.itemCount;
5018
5025
  if (this.isActive || !isNullOrUndefined(ulElement)) {
@@ -7915,8 +7922,8 @@ let DropDownTree = class DropDownTree extends Component {
7915
7922
  }
7916
7923
  addClass([this.inputEle], CHIP_INPUT);
7917
7924
  this.updateOverFlowView();
7918
- this.ensurePlaceHolder();
7919
7925
  }
7926
+ this.ensurePlaceHolder();
7920
7927
  }
7921
7928
  triggerChangeEvent(event) {
7922
7929
  const isEqual = this.ddtCompareValues(this.oldValue, this.value);
@@ -8520,10 +8527,10 @@ let DropDownTree = class DropDownTree extends Component {
8520
8527
  if (this.value !== null && this.value.length !== 0) {
8521
8528
  let data;
8522
8529
  if (this.showCheckBox || this.allowMultiSelection) {
8523
- for (let i = 0; i < this.value.length; i++) {
8530
+ for (let i = this.value.length - 1; i >= 0; i--) {
8524
8531
  data = this.treeObj.getTreeData(this.value[i])[0];
8525
8532
  if (isNullOrUndefined(data)) {
8526
- this.value.splice(this.value.indexOf(this.value[i]), 1);
8533
+ this.value.splice(i, 1);
8527
8534
  }
8528
8535
  }
8529
8536
  if (this.value.length !== 0) {
@@ -8580,7 +8587,7 @@ let DropDownTree = class DropDownTree extends Component {
8580
8587
  }
8581
8588
  }
8582
8589
  setSelectedValue() {
8583
- if (this.value != null) {
8590
+ if (this.value !== null && !(this.value.length === 0)) {
8584
8591
  return;
8585
8592
  }
8586
8593
  if (!this.isInitialized) {
@@ -9382,7 +9389,7 @@ let DropDownTree = class DropDownTree extends Component {
9382
9389
  }
9383
9390
  }
9384
9391
  ensurePlaceHolder() {
9385
- if (isNullOrUndefined(this.value) || (this.value && this.value.length === 0)) {
9392
+ if (isNullOrUndefined(this.value) || (this.value !== null && this.value.length === 0)) {
9386
9393
  removeClass([this.inputEle], CHIP_INPUT);
9387
9394
  if (this.chipWrapper) {
9388
9395
  addClass([this.chipWrapper], HIDEICON);
@@ -9680,7 +9687,10 @@ let DropDownTree = class DropDownTree extends Component {
9680
9687
  }
9681
9688
  }
9682
9689
  setTagValues() {
9683
- if (this.value === null || this.text == null) {
9690
+ if (this.value === null || this.text == null || this.value.length === 0) {
9691
+ if (this.inputWrapper.contains(this.chipWrapper)) {
9692
+ addClass([this.chipWrapper], HIDEICON);
9693
+ }
9684
9694
  return;
9685
9695
  }
9686
9696
  if (!this.inputWrapper.contains(this.chipWrapper)) {
@@ -13206,6 +13216,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
13206
13216
  if (this.isFiltered) {
13207
13217
  if ((this.enableVirtualization && !isNullOrUndefined(this.customFilterQuery))) {
13208
13218
  filterQuery = this.customFilterQuery.clone();
13219
+ return this.virtualFilterQuery(filterQuery);
13209
13220
  }
13210
13221
  else if (!this.enableVirtualization) {
13211
13222
  return filterQuery;
@@ -15039,7 +15050,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15039
15050
  getValue(((this.fields.value) ? this.fields.value : ''), this.value[this.value.length - 1]) :
15040
15051
  this.value[this.value.length - 1];
15041
15052
  const temp = text;
15042
- const textValues = this.text != null && this.text !== '' ? this.text + ',' + temp : temp;
15053
+ const textValues = this.text != null && this.text !== '' ? this.text + this.delimiterChar + temp : temp;
15043
15054
  currentText.push(textValues);
15044
15055
  this.setProperties({ text: currentText.toString() }, true);
15045
15056
  }
@@ -15969,7 +15980,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15969
15980
  }
15970
15981
  else {
15971
15982
  temp = isInitialVirtualData && delim ? this.text : this.getTextByValue(value);
15972
- const textValues = isInitialVirtualData ? this.text : (this.text && this.text !== '' ? this.text + ',' + temp : temp);
15983
+ const textValues = isInitialVirtualData ? this.text : (this.text && this.text !== '' ? this.text + this.delimiterChar + temp : temp);
15973
15984
  data += temp + delimiterChar + ' ';
15974
15985
  text.push(textValues);
15975
15986
  hiddenElementContent = this.hiddenElement.innerHTML;
@@ -16129,7 +16140,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
16129
16140
  (this.mode === 'Box' || this.mode === 'Default'))) ||
16130
16141
  (this.enableVirtualization && value != null && text != null && !isCustomData)) {
16131
16142
  const currentText = [];
16132
- const textValues = this.text != null && this.text !== '' ? this.text + ',' + text : text;
16143
+ const textValues = this.text != null && this.text !== '' ? this.text + this.delimiterChar + text : text;
16133
16144
  currentText.push(textValues);
16134
16145
  this.setProperties({ text: currentText.toString() }, true);
16135
16146
  this.addChip(text, value);
@@ -16165,7 +16176,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
16165
16176
  this.wireListEvents();
16166
16177
  }
16167
16178
  const currentText = [];
16168
- const textValues = this.text != null && this.text !== '' ? this.text + ',' + text : text;
16179
+ const textValues = this.text != null && this.text !== '' ? this.text + this.delimiterChar + text : text;
16169
16180
  currentText.push(textValues);
16170
16181
  this.setProperties({ text: currentText.toString() }, true);
16171
16182
  this.addChip(text, value);
@@ -22181,6 +22192,7 @@ let Mention = class Mention extends DropDownBase {
22181
22192
  e.preventDefault();
22182
22193
  const li = this.list.querySelector('.' + dropDownBaseClasses.selected);
22183
22194
  if (li) {
22195
+ this.isSelected = true;
22184
22196
  this.setSelection(li, e);
22185
22197
  }
22186
22198
  if (this.isPopupOpen) {