@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.
@@ -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
  }
@@ -1234,7 +1236,7 @@ let DropDownBase = class DropDownBase extends Component {
1234
1236
  for (let i = 0; i < totalSkeletonCount; i++) {
1235
1237
  const liElement = this.createElement('li', { className: dropDownBaseClasses.virtualList, styles: 'overflow: inherit' });
1236
1238
  if (this.isVirtualizationEnabled && this.itemTemplate) {
1237
- liElement.style.height = this.listItemHeight + 'px';
1239
+ liElement.style.height = (this.listItemHeight - parseInt(window.getComputedStyle(this.getItems()[1]).marginBottom, 10)) + 'px';
1238
1240
  }
1239
1241
  const skeleton = new Skeleton({
1240
1242
  shape: 'Text',
@@ -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)) {
@@ -7594,6 +7601,7 @@ let DropDownTree = class DropDownTree extends Component {
7594
7601
  }
7595
7602
  else if (args.preventDefaultAction) {
7596
7603
  fields = args.fields;
7604
+ this.treeObj.element.classList.add('e-filtering');
7597
7605
  }
7598
7606
  else {
7599
7607
  if (this.treeDataType === 1) {
@@ -7914,8 +7922,8 @@ let DropDownTree = class DropDownTree extends Component {
7914
7922
  }
7915
7923
  addClass([this.inputEle], CHIP_INPUT);
7916
7924
  this.updateOverFlowView();
7917
- this.ensurePlaceHolder();
7918
7925
  }
7926
+ this.ensurePlaceHolder();
7919
7927
  }
7920
7928
  triggerChangeEvent(event) {
7921
7929
  const isEqual = this.ddtCompareValues(this.oldValue, this.value);
@@ -8519,10 +8527,10 @@ let DropDownTree = class DropDownTree extends Component {
8519
8527
  if (this.value !== null && this.value.length !== 0) {
8520
8528
  let data;
8521
8529
  if (this.showCheckBox || this.allowMultiSelection) {
8522
- for (let i = 0; i < this.value.length; i++) {
8530
+ for (let i = this.value.length - 1; i >= 0; i--) {
8523
8531
  data = this.treeObj.getTreeData(this.value[i])[0];
8524
8532
  if (isNullOrUndefined(data)) {
8525
- this.value.splice(this.value.indexOf(this.value[i]), 1);
8533
+ this.value.splice(i, 1);
8526
8534
  }
8527
8535
  }
8528
8536
  if (this.value.length !== 0) {
@@ -8579,7 +8587,7 @@ let DropDownTree = class DropDownTree extends Component {
8579
8587
  }
8580
8588
  }
8581
8589
  setSelectedValue() {
8582
- if (this.value != null) {
8590
+ if (this.value !== null && !(this.value.length === 0)) {
8583
8591
  return;
8584
8592
  }
8585
8593
  if (!this.isInitialized) {
@@ -8998,7 +9006,9 @@ let DropDownTree = class DropDownTree extends Component {
8998
9006
  }
8999
9007
  if (this.isFilterRestore) {
9000
9008
  this.restoreFilterSelection();
9001
- this.isFilterRestore = false;
9009
+ if (!this.showSelectAll) {
9010
+ this.isFilterRestore = false;
9011
+ }
9002
9012
  }
9003
9013
  }
9004
9014
  restoreFilterSelection() {
@@ -9261,15 +9271,18 @@ let DropDownTree = class DropDownTree extends Component {
9261
9271
  this.ensurePlaceHolder();
9262
9272
  }
9263
9273
  if (this.showSelectAll && this.checkBoxElement) {
9274
+ const nodes = this.treeObj.element.querySelectorAll('li');
9264
9275
  const checkedNodes = this.treeObj.element.querySelectorAll('li[aria-checked=true]');
9265
9276
  const wrap = closest(this.checkBoxElement, '.' + CHECKBOXWRAP);
9266
- if (wrap && args.action === 'uncheck' && (args.isInteracted || checkedNodes.length === 0 || (!isNullOrUndefined(args.data[0]) && args.data[0].isChecked === 'false'))) {
9277
+ if ((wrap && args.action === 'uncheck' && (args.isInteracted || checkedNodes.length === 0 ||
9278
+ (!isNullOrUndefined(args.data[0]) && args.data[0].isChecked === 'false'))) || !args.isInteracted && this.isFilterRestore) {
9279
+ this.isFilterRestore = false;
9267
9280
  this.isReverseUpdate = true;
9268
9281
  this.changeState(wrap, 'uncheck');
9269
9282
  this.isReverseUpdate = false;
9270
9283
  }
9271
9284
  else if (wrap && args.action === 'check'
9272
- && checkedNodes.length === this.fields.dataSource.length
9285
+ && checkedNodes.length === nodes.length
9273
9286
  && (args.isInteracted || this.isCheckAllCalled || (!isNullOrUndefined(args.data[0]) && args.data[0].isChecked === 'true'))) {
9274
9287
  this.isReverseUpdate = true;
9275
9288
  this.isCheckAllCalled = false;
@@ -9376,7 +9389,7 @@ let DropDownTree = class DropDownTree extends Component {
9376
9389
  }
9377
9390
  }
9378
9391
  ensurePlaceHolder() {
9379
- if (isNullOrUndefined(this.value) || (this.value && this.value.length === 0)) {
9392
+ if (isNullOrUndefined(this.value) || (this.value !== null && this.value.length === 0)) {
9380
9393
  removeClass([this.inputEle], CHIP_INPUT);
9381
9394
  if (this.chipWrapper) {
9382
9395
  addClass([this.chipWrapper], HIDEICON);
@@ -9674,7 +9687,10 @@ let DropDownTree = class DropDownTree extends Component {
9674
9687
  }
9675
9688
  }
9676
9689
  setTagValues() {
9677
- 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
+ }
9678
9694
  return;
9679
9695
  }
9680
9696
  if (!this.inputWrapper.contains(this.chipWrapper)) {
@@ -13200,6 +13216,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
13200
13216
  if (this.isFiltered) {
13201
13217
  if ((this.enableVirtualization && !isNullOrUndefined(this.customFilterQuery))) {
13202
13218
  filterQuery = this.customFilterQuery.clone();
13219
+ return this.virtualFilterQuery(filterQuery);
13203
13220
  }
13204
13221
  else if (!this.enableVirtualization) {
13205
13222
  return filterQuery;
@@ -15033,7 +15050,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15033
15050
  getValue(((this.fields.value) ? this.fields.value : ''), this.value[this.value.length - 1]) :
15034
15051
  this.value[this.value.length - 1];
15035
15052
  const temp = text;
15036
- 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;
15037
15054
  currentText.push(textValues);
15038
15055
  this.setProperties({ text: currentText.toString() }, true);
15039
15056
  }
@@ -15620,7 +15637,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15620
15637
  this.list.scrollTop = 0;
15621
15638
  this.virtualListInfo = null;
15622
15639
  this.previousStartIndex = 0;
15623
- this.previousEndIndex = 0;
15640
+ this.previousEndIndex = this.itemCount;
15624
15641
  }
15625
15642
  this.isClearAllAction = false;
15626
15643
  }
@@ -15963,7 +15980,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
15963
15980
  }
15964
15981
  else {
15965
15982
  temp = isInitialVirtualData && delim ? this.text : this.getTextByValue(value);
15966
- 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);
15967
15984
  data += temp + delimiterChar + ' ';
15968
15985
  text.push(textValues);
15969
15986
  hiddenElementContent = this.hiddenElement.innerHTML;
@@ -16123,7 +16140,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
16123
16140
  (this.mode === 'Box' || this.mode === 'Default'))) ||
16124
16141
  (this.enableVirtualization && value != null && text != null && !isCustomData)) {
16125
16142
  const currentText = [];
16126
- 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;
16127
16144
  currentText.push(textValues);
16128
16145
  this.setProperties({ text: currentText.toString() }, true);
16129
16146
  this.addChip(text, value);
@@ -16159,7 +16176,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
16159
16176
  this.wireListEvents();
16160
16177
  }
16161
16178
  const currentText = [];
16162
- 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;
16163
16180
  currentText.push(textValues);
16164
16181
  this.setProperties({ text: currentText.toString() }, true);
16165
16182
  this.addChip(text, value);
@@ -17793,7 +17810,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
17793
17810
  this.viewPortInfo.endIndex : this.itemCount;
17794
17811
  this.virtualListInfo = this.viewPortInfo;
17795
17812
  this.previousStartIndex = 0;
17796
- this.previousEndIndex = 0;
17813
+ this.previousEndIndex = this.itemCount;
17797
17814
  }
17798
17815
  let dataSourceCount;
17799
17816
  if (this.dataSource instanceof DataManager) {
@@ -21215,7 +21232,7 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
21215
21232
  ctrlKey: e.ctrlKey, shiftKey: e.shiftKey
21216
21233
  });
21217
21234
  }
21218
- else if (e.keyCode === 65 && e.ctrlKey) {
21235
+ else if (e.keyCode === 65 && e.ctrlKey && this.selectionSettings.mode === 'Multiple') {
21219
21236
  this.selectAll();
21220
21237
  }
21221
21238
  else if ((e.keyCode === 38 || e.keyCode === 40) && e.ctrlKey && e.shiftKey) {
@@ -22175,6 +22192,7 @@ let Mention = class Mention extends DropDownBase {
22175
22192
  e.preventDefault();
22176
22193
  const li = this.list.querySelector('.' + dropDownBaseClasses.selected);
22177
22194
  if (li) {
22195
+ this.isSelected = true;
22178
22196
  this.setSelection(li, e);
22179
22197
  }
22180
22198
  if (this.isPopupOpen) {