@syncfusion/ej2-dropdowns 28.1.36 → 28.1.38

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;
@@ -1775,7 +1776,17 @@ let DropDownBase = class DropDownBase extends Component {
1775
1776
  const liCollections = listElement.querySelectorAll('.' + dropDownBaseClasses.li);
1776
1777
  for (let index = 0; index < liCollections.length; index++) {
1777
1778
  if (JSON.parse(JSON.stringify(this.listData[index]))[this.fields.disabled]) {
1778
- this.disableListItem(liCollections[index]);
1779
+ if (!isNullOrUndefined(this.fields.groupBy)) {
1780
+ const item = this.listData[index];
1781
+ const value = getValue((this.fields.value ? this.fields.value : 'value'), item);
1782
+ const li = listElement.querySelector('li[data-value="' + value + '"]');
1783
+ if (!isNullOrUndefined(li)) {
1784
+ this.disableListItem(li);
1785
+ }
1786
+ }
1787
+ else {
1788
+ this.disableListItem(liCollections[index]);
1789
+ }
1779
1790
  }
1780
1791
  }
1781
1792
  }
@@ -1915,7 +1926,8 @@ let DropDownBase = class DropDownBase extends Component {
1915
1926
  }
1916
1927
  scrollStop(e, isDownkey) {
1917
1928
  const target = !isNullOrUndefined(e) ? e.target : this.list;
1918
- const liHeight = parseInt(getComputedStyle(this.getValidLi(), null).getPropertyValue('height'), 10);
1929
+ const computedHeight = getComputedStyle(this.getValidLi(), null).getPropertyValue('height');
1930
+ const liHeight = this.getModuleName() === 'multiselect' ? parseFloat(computedHeight) : parseInt(computedHeight, 10);
1919
1931
  const topIndex = Math.round(target.scrollTop / liHeight);
1920
1932
  const liCollections = this.list.querySelectorAll('li' + ':not(.e-hide-listitem)');
1921
1933
  const virtualListCount = this.list.querySelectorAll('.e-virtual-list').length;
@@ -4587,6 +4599,7 @@ let DropDownList = class DropDownList extends DropDownBase {
4587
4599
  onFilterUp(e) {
4588
4600
  if (!(e.ctrlKey && e.keyCode === 86) && (this.isValidKey || e.keyCode === 40 || e.keyCode === 38)) {
4589
4601
  this.isValidKey = false;
4602
+ this.filterArgs = e;
4590
4603
  this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
4591
4604
  switch (e.keyCode) {
4592
4605
  case 38: //up arrow
@@ -4640,7 +4653,9 @@ let DropDownList = class DropDownList extends DropDownBase {
4640
4653
  }
4641
4654
  this.typedString = this.filterInput.value;
4642
4655
  this.preventAutoFill = false;
4643
- this.searchLists(e);
4656
+ if (!this.getInitialData) {
4657
+ this.searchLists(e);
4658
+ }
4644
4659
  if ((this.enableVirtualization && this.getModuleName() !== 'autocomplete') || (this.getModuleName() === 'autocomplete' && !(this.dataSource instanceof DataManager)) || (this.getModuleName() === 'autocomplete' && (this.dataSource instanceof DataManager) && this.totalItemCount !== 0)) {
4645
4660
  this.getFilteringSkeletonCount();
4646
4661
  }
@@ -4985,6 +5000,9 @@ let DropDownList = class DropDownList extends DropDownBase {
4985
5000
  pasteHandler(e) {
4986
5001
  setTimeout(() => {
4987
5002
  this.typedString = this.filterInput.value;
5003
+ if (this.getModuleName() === 'combobox' && this.isFiltering() && isNullOrUndefined(this.list)) {
5004
+ this.renderList();
5005
+ }
4988
5006
  this.searchLists(e);
4989
5007
  });
4990
5008
  }
@@ -5009,10 +5027,9 @@ let DropDownList = class DropDownList extends DropDownBase {
5009
5027
  }
5010
5028
  if (this.getInitialData) {
5011
5029
  this.updateActionCompleteDataValues(ulElement, list);
5012
- }
5013
- if (!this.preventPopupOpen && this.getModuleName() === 'combobox') {
5014
- this.beforePopupOpen = true;
5015
- this.preventPopupOpen = true;
5030
+ this.getInitialData = false;
5031
+ this.searchLists(this.filterArgs);
5032
+ return;
5016
5033
  }
5017
5034
  const tempItemCount = this.itemCount;
5018
5035
  if (this.isActive || !isNullOrUndefined(ulElement)) {
@@ -5464,7 +5481,7 @@ let DropDownList = class DropDownList extends DropDownBase {
5464
5481
  this.destroyPopup();
5465
5482
  }
5466
5483
  });
5467
- if (this.allowResize) {
5484
+ if (this.allowResize && (this.getModuleName() !== 'dropdownlist' || !(Browser.isDevice && this.isDeviceFullScreen && this.allowFiltering))) {
5468
5485
  const resizePaddingBottom = 16;
5469
5486
  // Create the resizer div
5470
5487
  this.resizer = this.createElement('div', {
@@ -7628,6 +7645,9 @@ let DropDownTree = class DropDownTree extends Component {
7628
7645
  }
7629
7646
  this.treeObj.fields = this.getTreeFields(fields);
7630
7647
  this.treeObj.dataBind();
7648
+ if (this.popupObj) {
7649
+ this.popupObj.refreshPosition();
7650
+ }
7631
7651
  if (this.hasTemplate && this.portals && this.treeObj.portals) {
7632
7652
  for (let i = 0; i < this.treeObj.portals.length; i++) {
7633
7653
  if (this.portals.indexOf(this.treeObj.portals[i]) === -1) {
@@ -7915,8 +7935,8 @@ let DropDownTree = class DropDownTree extends Component {
7915
7935
  }
7916
7936
  addClass([this.inputEle], CHIP_INPUT);
7917
7937
  this.updateOverFlowView();
7918
- this.ensurePlaceHolder();
7919
7938
  }
7939
+ this.ensurePlaceHolder();
7920
7940
  }
7921
7941
  triggerChangeEvent(event) {
7922
7942
  const isEqual = this.ddtCompareValues(this.oldValue, this.value);
@@ -8520,10 +8540,10 @@ let DropDownTree = class DropDownTree extends Component {
8520
8540
  if (this.value !== null && this.value.length !== 0) {
8521
8541
  let data;
8522
8542
  if (this.showCheckBox || this.allowMultiSelection) {
8523
- for (let i = 0; i < this.value.length; i++) {
8543
+ for (let i = this.value.length - 1; i >= 0; i--) {
8524
8544
  data = this.treeObj.getTreeData(this.value[i])[0];
8525
8545
  if (isNullOrUndefined(data)) {
8526
- this.value.splice(this.value.indexOf(this.value[i]), 1);
8546
+ this.value.splice(i, 1);
8527
8547
  }
8528
8548
  }
8529
8549
  if (this.value.length !== 0) {
@@ -8580,7 +8600,7 @@ let DropDownTree = class DropDownTree extends Component {
8580
8600
  }
8581
8601
  }
8582
8602
  setSelectedValue() {
8583
- if (this.value != null) {
8603
+ if (this.value !== null && !(this.value.length === 0)) {
8584
8604
  return;
8585
8605
  }
8586
8606
  if (!this.isInitialized) {
@@ -9382,7 +9402,7 @@ let DropDownTree = class DropDownTree extends Component {
9382
9402
  }
9383
9403
  }
9384
9404
  ensurePlaceHolder() {
9385
- if (isNullOrUndefined(this.value) || (this.value && this.value.length === 0)) {
9405
+ if (isNullOrUndefined(this.value) || (this.value !== null && this.value.length === 0)) {
9386
9406
  removeClass([this.inputEle], CHIP_INPUT);
9387
9407
  if (this.chipWrapper) {
9388
9408
  addClass([this.chipWrapper], HIDEICON);
@@ -9680,7 +9700,10 @@ let DropDownTree = class DropDownTree extends Component {
9680
9700
  }
9681
9701
  }
9682
9702
  setTagValues() {
9683
- if (this.value === null || this.text == null) {
9703
+ if (this.value === null || this.text == null || this.value.length === 0) {
9704
+ if (this.inputWrapper.contains(this.chipWrapper)) {
9705
+ addClass([this.chipWrapper], HIDEICON);
9706
+ }
9684
9707
  return;
9685
9708
  }
9686
9709
  if (!this.inputWrapper.contains(this.chipWrapper)) {
@@ -13206,6 +13229,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
13206
13229
  if (this.isFiltered) {
13207
13230
  if ((this.enableVirtualization && !isNullOrUndefined(this.customFilterQuery))) {
13208
13231
  filterQuery = this.customFilterQuery.clone();
13232
+ return this.virtualFilterQuery(filterQuery);
13209
13233
  }
13210
13234
  else if (!this.enableVirtualization) {
13211
13235
  return filterQuery;
@@ -15039,7 +15063,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15039
15063
  getValue(((this.fields.value) ? this.fields.value : ''), this.value[this.value.length - 1]) :
15040
15064
  this.value[this.value.length - 1];
15041
15065
  const temp = text;
15042
- const textValues = this.text != null && this.text !== '' ? this.text + ',' + temp : temp;
15066
+ const textValues = this.text != null && this.text !== '' ? this.text + this.delimiterChar + temp : temp;
15043
15067
  currentText.push(textValues);
15044
15068
  this.setProperties({ text: currentText.toString() }, true);
15045
15069
  }
@@ -15969,7 +15993,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15969
15993
  }
15970
15994
  else {
15971
15995
  temp = isInitialVirtualData && delim ? this.text : this.getTextByValue(value);
15972
- const textValues = isInitialVirtualData ? this.text : (this.text && this.text !== '' ? this.text + ',' + temp : temp);
15996
+ const textValues = isInitialVirtualData ? this.text : (this.text && this.text !== '' ? this.text + this.delimiterChar + temp : temp);
15973
15997
  data += temp + delimiterChar + ' ';
15974
15998
  text.push(textValues);
15975
15999
  hiddenElementContent = this.hiddenElement.innerHTML;
@@ -16129,7 +16153,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
16129
16153
  (this.mode === 'Box' || this.mode === 'Default'))) ||
16130
16154
  (this.enableVirtualization && value != null && text != null && !isCustomData)) {
16131
16155
  const currentText = [];
16132
- const textValues = this.text != null && this.text !== '' ? this.text + ',' + text : text;
16156
+ const textValues = this.text != null && this.text !== '' ? this.text + this.delimiterChar + text : text;
16133
16157
  currentText.push(textValues);
16134
16158
  this.setProperties({ text: currentText.toString() }, true);
16135
16159
  this.addChip(text, value);
@@ -16165,7 +16189,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
16165
16189
  this.wireListEvents();
16166
16190
  }
16167
16191
  const currentText = [];
16168
- const textValues = this.text != null && this.text !== '' ? this.text + ',' + text : text;
16192
+ const textValues = this.text != null && this.text !== '' ? this.text + this.delimiterChar + text : text;
16169
16193
  currentText.push(textValues);
16170
16194
  this.setProperties({ text: currentText.toString() }, true);
16171
16195
  this.addChip(text, value);
@@ -22181,6 +22205,7 @@ let Mention = class Mention extends DropDownBase {
22181
22205
  e.preventDefault();
22182
22206
  const li = this.list.querySelector('.' + dropDownBaseClasses.selected);
22183
22207
  if (li) {
22208
+ this.isSelected = true;
22184
22209
  this.setSelection(li, e);
22185
22210
  }
22186
22211
  if (this.isPopupOpen) {